文字

ArrayIterator::seek

(PHP 5 >= 5.0.0)

ArrayIterator::seekSeek to position

说明

public void ArrayIterator::seek ( int $position )
Warning

本函数还未编写文档,仅有参数列表。

参数

position

The position to seek to.

返回值

没有返回值。

用户评论:

[#1] jon at ngsthings dot com [2008-10-21 17:08:20]

<?php
// didn't see any code demos...here's one from an app I'm working on

$array = array('1' => 'one',
               
'2' => 'two',
               
'3' => 'three');

$arrayobject = new ArrayObject($array);
$iterator $arrayobject->getIterator();

if(
$iterator->valid()){
    
$iterator->seek(1);            // expected: two, output: two
    
echo $iterator->current();    // two
}

?>

上一篇: 下一篇: