PHP Array Element Reset Function

What is reset() Function?

Explanation

The "reset()" function sets the internal pointer of an array to its first element.

Syntax:


reset(array)

In the above syntax "array" is the array in which the internal pointer is set to the first element.

Example :


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

Grapes.
Apple.
Grapes.

In the above example the array "$b" first the current value, then the next value and the resetted value is displayed.

PHP Topics


Ask Questions

Ask Question