3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Creating dummy variables for ($i = 0; $i < 500; ++$i) ${md5(microtime(true))} = openssl_random_pseudo_bytes(mt_rand(1, 1000)); $items = ["one", "two", "three"]; $ignore = "two"; $iterations = 1000; $preStartTime = microtime(true); for ($i = 0; $i < $iterations; ++$i) { array_filter($items, call_user_func(function ($context·cfcd208495d565ef66e7dff9f98764da) { return function ($item) use ($context·cfcd208495d565ef66e7dff9f98764da) { extract($context·cfcd208495d565ef66e7dff9f98764da); return $item !== $ignore; }; }, get_defined_vars())); } $preTime = microtime(true) - $preStartTime; $vanillaStartTime = microtime(true); for ($i = 0; $i < $iterations; ++$i) { array_filter($items, function ($item) use ($ignore) { return $item !== $ignore; }); } $vanillaTime = microtime(true) - $vanillaStartTime; echo 'Pre: '.($preTime*1000).'ms'.PHP_EOL; echo 'Vanilla: '.($vanillaTime*1000).'ms'.PHP_EOL;
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.26, 7.3.0 - 7.3.13, 7.4.0 - 7.4.1
Fatal error: Uncaught Error: Call to undefined function openssl_random_pseudo_bytes() in /in/tTLRk:4 Stack trace: #0 {main} thrown in /in/tTLRk on line 4
Process exited with code 255.
Output for 5.6.0 - 5.6.40
Fatal error: Call to undefined function openssl_random_pseudo_bytes() in /in/tTLRk on line 4
Process exited with code 255.

preferences:
71.33 ms | 407 KiB | 5 Q