The next() function advance the internal array pointer of an array to the next element.
Syntax
next(arr)
Parameters
arr − The specified array
Return
The next() function returns the value of the next element in the array, on success. It returns FALSE, if no more elements are available.
Example
The following is an example −
<?php $os = array('windows', 'mac', 'linux', 'solaris'); echo current($os) . "<br>"; echo next($os); ?>
Output
windows mac
Example
Let us see another example −
<?php $a = array('one', 'two', 'three', 'four', 'five', 'six' ); echo current($a)."\n"; echo next($a)."\n"; echo current($a)."\n"; echo next($a)."\n"; echo end($a)."\n"; echo current($a)."\n"; ?>
Output
one two two three six six