each

It return the current key and value pair from an array and advance the array cursor

Example

<?php
echo “<pre>”;
$array = array(“php”, “asp”, “jsp”, “as”, “js”);
$array2 = each($array);
print_r($array2);
?>

Output

Array
(
[1] => php
[value] => php
[0] => 0
[key] => 0
)

Share