Thursday, 25 September 2014

next in PHP

PHP next() function is utilized to move internal pointer of an array to next element and returns it.
This function returns value of next element from array on success, or else FALSE if there are no more elements.

Syntax:

next(array)
array : Required. Specifies the array to use.
Note : PHP next() function returns FALSE on empty elements or elements with no value.

Example:

<?php
$daysarr = array( "Sunday","Monday","Tuesday","Wednesday","Thursday" );
echo current($daysarr) . "<br />";
echo next($daysarr);
?>

O/P:

Sunday
Monday

0 comments:

Post a Comment