each
PHP 4, PHP 5, PHP 7
Deprecated: PHP 7.2.0
each - Return the current key and value pair from an array and advance the array cursor
Example #1 Traversing an array with each
to traverse an array, here's an
example:
Result: a => apple
b => banana
c => cranberry
Example #2 each examples
Result: Array
(
[1] => bob
[value] => bob
[0] => 0
[key] => 0
)
Example #3
Result: Array
(
[1] => Bob
[value] => Bob
[0] => Robert
[key] => Robert
)