Thursday, 25 September 2014

end in PHP

PHP end() function is utilized to move the internal pointer to the last element in the array.

PHP end() function returns the value of the final element from the array on success.

Syntax:

end(array)
array : Required. Specifies the array to use.

Example:

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

Output will be:

Sunday 
Thursday

0 comments:

Post a Comment