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

Anonymous Functions

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

<?php
// declare a strings array
$strings = ["apple", "orange", "banana", "coconut"];

// measure the length of each string in the array
$lengths = array_map( function($item) { return strlen($item); } , $strings);

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