downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

例外> <SeekableIterator
Last updated: Fri, 13 Nov 2009

view this page in

SeekableIterator::seek

(PHP 5 >= 5.1.0)

SeekableIterator::seek位置を移動する

説明

abstract public void SeekableIterator::seek ( int $position )

イテレータ内の指定した位置に移動します。

パラメータ

position

移動先の位置。

返り値

値を返しません。

エラー / 例外

position に移動できない場合、 OutOfBoundsException をスローするよう実装しなければなりません。

例1 SeekableIterator::seek の例

イテレータの 3 番目の位置に移動します (ArrayIteratorSeekableIterator を実装しています)。

<?php
$array 
= array("apple""banana""cherry""damson""elderberry");
$iterator = new ArrayIterator($array);
$iterator->seek(3);
echo 
$iterator->current();
?>

上の例の出力は、 たとえば以下のようになります。

damson



add a note add a note User Contributed Notes
SeekableIterator::seek
There are no user contributed notes for this page.

例外> <SeekableIterator
Last updated: Fri, 13 Nov 2009
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites