<?php
mix reset ( arr &$array )
where,
$array = The given input ARRAY
?>
<?php
$arr01r = [ "first index" => "FIRST ELEMENT",
"second index" => "SECOND ELEMENT",
"third index" => "THIRD ELEMENT",
"fourth index" => "FOURTH ELEMENT",
"fifth index" => "FIFITH ELEMENT",
"sixth index" => "SIXTH ELEMENT" ];
echo 'The given ARRAY:<br>';
print_r($arr01r);
echo '<br><br>The current INDEX:<br>';
$ndx01r = key($arr01r);
print_r($ndx01r);
echo '<br><br>The current ELEMENT:<br>';
$frs01r = current($arr01r);
print_r($frs01r);
echo '<br><br>The last INDEX:<br>';
$lst01r = end($arr01r);
$key01r = key($arr01r);
print_r($key01r);
echo '<br><br>The last ELEMENT:<br>';
print_r($lst01r);
echo '<br><br>(The internal pointer have reset 2 times)<br>';
$prev01r1 = prev($arr01r);
$prev01r2 = prev($arr01r);
echo 'The current INDEX:<br>';
$key01r2 = key($arr01r);
print_r($key01r2);
echo '<br><br>The current ELEMENT:<br>';
print_r($prev01r2);
echo '<br><br>(Reset the internal pointer to its first ELEMENT)<br>';
$res01r3 = reset($arr01r);
echo 'The current INDEX:<br>';
$ndx01r3 = key($arr01r);
print_r($ndx01r3);
echo '<br><br>The current ELEMENT:<br>';
print_r($res01r3);
?>
<?php
$arr02r = [];
echo 'The given ARRAY:<br>';
print_r($arr02r);
echo '<br><br>The current INDEX:<br>';
$ndx02r = key($arr02r);
var_dump($ndx02r);
echo '<br><br>The current ELEMENT:<br>';
$frs02r = current($arr02r);
var_dump($frs02r);
echo '<br><br>The last INDEX:<br>';
$lst02r = end($arr02r);
$key02r = key($arr02r);
var_dump($key02r);
echo '<br><br>The last ELEMENT:<br>';
var_dump($lst02r);
echo '<br><br>(The internal pointer have reset 2 times)<br>';
$prev02r1 = prev($arr02r);
$prev02r2 = prev($arr02r);
echo 'The current INDEX:<br>';
$key02r2 = key($arr02r);
var_dump($key02r2);
echo '<br><br>The current ELEMENT:<br>';
var_dump($prev02r2);
echo '<br><br>(Reset the internal pointer to its first ELEMENT)<br>';
$res02r3 = reset($arr02r);
echo 'The current INDEX:<br>';
$ndx02r3 = key($arr02r);
var_dump($ndx02r3);
echo '<br><br>The current ELEMENT:<br>';
var_dump($res02r3);
?>