|
|
PHP Array each() Function
|
Tutorials » Php »
|
Topic |
What is each() Function?
|
|
Explanation |
|
The "each()" function returns the current key and value pair from an array and advance the array cursor.
Syntax:
each(array)
In the above syntax "array" is the array from which the current key, value pair is returned and the
cursor moves to the next element.
Example
<?php
$b=array("Grapes","Apple","Cherry");
print_r (each($b));
?>
Result:
Array ( [1] => Grapes [value] =>Grapes [0] => 0 [key] => 0 )
In the above example the current element key and value from the array "$b" is displayed and the cursor moves to the next element.
|
|
A Note |
Learn PHP programming language tutorial with simple and neat example. Hope you enjoy this free tutorial.
Do give us your valuable feedback and suggestions on this online tutorial. This is a Copyright Content.
|
|
|
|