略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: SplFixedArray::next

2024-04-26

SplFixedArray::next

(PHP 5 >= 5.3.0, PHP 7)

SplFixedArray::nextMove to next entry

说明

public SplFixedArray::next(): void

Move the iterator to the next array entry.

参数

此函数没有参数。

返回值

没有返回值。

add a noteadd a note

User Contributed Notes 1 note

up
1
kishor10d at gmail dot com
2 years ago
<?php

/**
* Example : rewind();
*/

$arr = new SplFixedArray(5);

$a = $arr->key(); //Zero'th index
var_dump($a);
echo
"<br>";

$arr->next(); // Shift to first index
$a = $arr->key();
var_dump($a);
echo
"<br>";

$arr->next(); // Shift to second index
$a = $arr->key();
var_dump($a);
echo
"<br>";

$arr->next();  // Shift to third index
$a = $arr->key();
var_dump($a);
echo
"<br>";
?>

The above example will output:

int(0)
int(1)
int(2)
int(3)

官方地址:https://www.php.net/manual/en/splfixedarray.next.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3