forEach()
The forEach() method executes a provided function once for each array element.
Example.php
Syntax
Parameter
$callback
A function to execute on each element, taking three arguments:
$value
The current element being processed in the array.$key
The index of the current element being processed in the array.$array
The arrayevery
was called upon.
Return value
oneself back for method chaining.
Prefixing
References
Last updated