Thursday, 25 September 2014

reset in PHP

PHP reset function gives us a way to rewind that pointer to the starting, it set the pointer to the first key pair and then gives back where its due value.

The PHP reset function returns the value of the first element from array on success, or else FALSE on failure.

Syntax:


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

Example:


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

O/P:


Sunday
Monday
Sunday

0 comments:

Post a Comment