PHP Array next() Function

What is next() Function?

Explanation

The "next()" function advances the internal array pointer of an array.

Syntax:


next(array)

In the above syntax "array" is the array in which the internal pointer is to be advanced.

Example :


<?php
$b=array("Grapes","Apple","Cherry");
echo current($b)."<br/>";
echo next($b)
?>
Result :

Grapes
Apple

In the above example from the array "$b" current element is displayed, then the pointer is moved using the next() to display "Apple".

PHP Topics


Ask Questions

Ask Question