array_map()
Applies a callback function to each element of one or more arrays and returns a new array of results.
Syntax
php
array_map(callable $callback, array $array): arrayExample
php
$nums = [1, 2, 3, 4];
$doubled = array_map(fn($n) => $n * 2, $nums);
// [2, 4, 6, 8]
$words = ["hello", "world"];
$upper = array_map("strtoupper", $words);
// ["HELLO", "WORLD"]