3v4l.org

run code in 300+ PHP versions simultaneously
<?php date_default_timezone_set('America/New_York'); class Block { private $start; private $end; private $callback; public function __construct($start, $end, callable $callback) { $this->start = $start; $this->end = $end; $this->callback = $callback; } public function check($time) { return $time > strtotime($this->start) && $time > strtotime($this->end); } public function invoke() { call_user_func($this->callback); } } $blocks = [ new Block('16:00:00', '18:00:00', function () { echo 'Foo!' }), new Block('18:00:00', '20:00:00', function () { echo 'Bar!' }), new Block('20:00:00', '22:00:00', function () { echo 'Qux!' }), ]; while (true) { foreach ($blocks as $block) { if ($block->check()) { $block->invoke(); } } sleep(1); }

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.170.0210.05312.39
5.4.160.0220.03912.39
5.4.150.0150.04512.38
5.4.140.0230.05012.07
5.4.130.0150.04312.06
5.4.120.0170.04112.02
5.4.110.0160.04112.02
5.4.100.0140.04512.02
5.4.90.0200.05512.02
5.4.80.0160.04212.02
5.4.70.0170.04012.02
5.4.60.0160.04212.02
5.4.50.0130.04312.01
5.4.40.0180.03812.00
5.4.30.0180.04111.99
5.4.20.0150.04111.99
5.4.10.0150.04211.99
5.4.00.0160.04111.49
5.3.270.0040.04012.72
5.3.260.0160.04512.72
5.3.250.0050.04112.72
5.3.240.0280.06412.72
5.3.230.0190.04312.71
5.3.220.0140.04612.68
5.3.210.0200.05612.68
5.3.200.0160.04412.68
5.3.190.0250.05212.68
5.3.180.0210.05412.67
5.3.170.0150.04512.67
5.3.160.0140.04712.67
5.3.150.0180.04112.68
5.3.140.0190.04112.66
5.3.130.0160.04512.65
5.3.120.0140.04612.65
5.3.110.0250.06612.66
5.3.100.0230.05212.12
5.3.90.0170.04312.10
5.3.80.0250.06512.09
5.3.70.0210.05612.09
5.3.60.0150.04612.07
5.3.50.0140.04712.03
5.3.40.0180.05912.02
5.3.30.0150.04411.99
5.3.20.0130.04511.78
5.3.10.0130.04511.73
5.3.00.0160.04111.71

preferences:
143.2 ms | 1394 KiB | 7 Q