Thursday, 25 September 2014

current in PHP

PHP current() function returns the stored value that the present pointer points to.
When array show is recently made with elements, the element pointed to will always be the first element.

Syntax:

current(array)
array : Required. Specifies the array to use.
Tip : This function does not move the arrays internal pointer. To do this, utilize the next() and prev() functions.
Note : This function returns FALSE for empty elements or elements with no value.

Example:

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

Output will be:

Sunday

0 comments:

Post a Comment