phpday 2027 - Call for Papers

SplFixedArray::next

(PHP 5 >= 5.3.0, PHP 7)

SplFixedArray::next — Move to next entry

警告

此功能自 PHP 8.0.0 起移除。

说明

public function SplFixedArray::next(): void

Move the iterator to the next array entry.

参数

此函数没有参数。

返回值

没有返回值。

更新日志

版本 说明
8.0.0 此函数已移除。 Use SplFixedArray::getIterator() instead.
+添加备注

用户贡献的备注 1 note

up
1
kishor10d at gmail dot com
7 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)
To Top