flatMap()
The flatMap() method create a new array formed by applying function and then flattening the result by one level
Example.php
Syntax
Parameter
$callback
A function that produces an element of the new Array, 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
A new array with each element being the result of the callback function and flattened to a depth of 1.
Prefixing
References
Last updated