3v4l.org

run code in 300+ PHP versions simultaneously
<?php function memoize($func) { return function () use ($func) { static $cache = []; $args = func_get_args(); $key = md5(serialize($args)); if ( !isset($cache[$key]) ) { $cache[$key] = call_user_func_array($func, $args); } return $cache[$key]; }; }; $cube = function($number) { return $number * $number * $number; }; $cube3 = memoize($cube, 3; echo $cube3();
Output for 5.5.24 - 5.5.30, 5.6.8 - 5.6.15
Parse error: syntax error, unexpected ';' in /in/BpXS8 on line 22
Process exited with code 255.

preferences:
169.44 ms | 1387 KiB | 22 Q