PHP Conference Kansai 2026 (JAPAN)

SplFixedArray::next

(PHP 5 >= 5.3.0, PHP 7)

SplFixedArray::next — Move to next entry

Warnung

Dieses Feature wurde in PHP 8.0.0 ENTFERNT.

Beschreibung

public function SplFixedArray::next(): void

Move the iterator to the next array entry.

Parameter-Liste

Diese Funktion besitzt keine Parameter.

Rückgabewerte

Es wird kein Wert zurückgegeben.

Changelog

Version Beschreibung
8.0.0 Diese Funktion wurde entfernt. Use SplFixedArray::getIterator() instead.
+add a note

User Contributed Notes 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