3v4l.org

run code in 300+ PHP versions simultaneously
<?php function array_map_key(Callable $callback, $array) { $return = array(); foreach ($array as $key => $value) { list($k,$v) = $callback($key, $value); $return[$k] = $v; } return $return; } function my_call_back($key, $value) { return array($value, strlen($value)); } $array = explode(" ", "PHP stands for PHP hypertext preprocessor"); $array = array_map_key('my_call_back', $array); var_dump($array);

preferences:
32.95 ms | 405 KiB | 5 Q