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 git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught ArgumentCountError: Too few arguments to function {closure}(), 0 passed in /in/QXTZP on line 10 and exactly 1 expected in /in/QXTZP:18 Stack trace: #0 /in/QXTZP(10): {closure}() #1 /in/QXTZP(24): {closure}() #2 {main} thrown in /in/QXTZP on line 18
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
69.47 ms | 401 KiB | 8 Q