This site is mobile accessible. Press the "Tap Here" button to use a different font-size.


Smartphone icons created by Freepik - Flaticon

PHP Callback Functions

Array ( [0] => 5 [1] => 6 [2] => 6 [3] => 7 )

<?php
// create callback function
function my_callback($item) {
  return strlen($item);
}

// measure the length of each string in an array
$strings = ["apple", "orange", "banana", "coconut"];
$lengths = array_map("my_callback", $strings);

// display the results
print_r($lengths);
?>