array_map() / array_filter()
Transform every element / filter based on a condition.
Syntax
array_map($fn, $arr) · array_filter($arr, $fn)
Description
array_map transforms every element; array_filter selects those matching the condition.
Example
Loading editor…
Expected output
1,4,9
When to use?
List transformation and filtering.