SplFixedArray::next

(PHP 5 >= 5.3.0, PHP 7)

SplFixedArray::nextMove to next entry

Description

public SplFixedArray::next(): void

Move the iterator to the next array entry.

Parameters

This function has no parameters.

Return Values

No value is returned.

add a note

User Contributed Notes 1 note

up
1
kishor10d at gmail dot com
5 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

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant