3v4l.org

run code in 300+ PHP versions simultaneously
<?php function decorate(callable $fn, callable $decorator) { return function() use ($fn, $decorator) { $d = $decorator(); $gen = $d(); if (is_array($gen->current())) { $arguments = $gen->current(); } else { $arguments = func_get_args(); } $gen->send(call_user_func_array($fn, $arguments); }; } function foo() { throw new Exception("Error!"); } function catch_all_exceptions() { return function() { try { (yield ["foo" => "bar"]); } catch (\Exception $e) { echo "Caught Exception: $e\n"; } }; } $foo = decorate("foo", "catch_all_exceptions"); $foo();

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
5.4.100.0160.04312.01
5.4.90.0170.04112.01
5.4.80.0170.04112.01
5.4.70.0170.04012.01
5.4.60.0170.04012.01
5.4.50.0260.05012.00
5.4.40.0130.04311.99
5.4.30.0150.04311.99
5.4.20.0150.04211.98
5.4.10.0150.04211.99
5.4.00.0130.04211.48
5.3.200.0160.04512.68
5.3.190.0190.04412.67
5.3.180.0210.04912.67
5.3.170.0140.04512.67
5.3.160.0160.04412.67
5.3.150.0170.04412.67
5.3.140.0170.04212.66
5.3.130.0160.04412.66
5.3.120.0250.05612.66
5.3.110.0250.05812.66
5.3.100.0190.05312.12
5.3.90.0200.05712.10
5.3.80.0170.04312.08
5.3.70.0150.04512.08
5.3.60.0160.04312.08
5.3.50.0160.05412.02
5.3.40.0220.05912.02
5.3.30.0140.04311.98
5.3.20.0170.04011.77
5.3.10.0150.04111.73
5.3.00.0130.04311.71

preferences:
139.23 ms | 1394 KiB | 7 Q