Get your own PHP server Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<body>
<?php
function my_callback($item) {
  return strlen($item);
}
$strings = ["apple", "orange", "banana", "coconut"];
$lengths = array_map("my_callback", $strings);
print_r($lengths);
?>
</body>
</html>
Array
(
    [0] => 5
    [1] => 6
    [2] => 6
    [3] => 7
)