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(time())) { $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)
7.2.00.0080.00819.53
7.1.100.0110.00518.40
7.1.70.0040.00417.13
7.1.60.0090.01519.70
7.1.50.0190.00317.32
7.1.00.0000.07322.27
7.0.200.0040.00417.04
7.0.140.0030.07322.15
7.0.90.0070.07321.83
7.0.80.0000.08721.65
7.0.70.0030.04021.79
7.0.60.0070.06721.68
7.0.50.0070.07722.16
7.0.40.0030.08720.18
7.0.30.0070.08320.10
7.0.20.0070.03719.95
7.0.10.0070.07320.11
7.0.00.0100.06720.08
5.6.280.0130.06320.87
5.6.240.0130.06720.59
5.6.230.0070.07320.68
5.6.220.0000.04320.71
5.6.210.0070.04320.75
5.6.200.0000.08320.97
5.6.190.0030.08020.95
5.6.180.0100.07020.97
5.6.170.0100.07321.18
5.6.160.0170.07321.06
5.6.150.0070.06321.04
5.6.140.0030.06021.13
5.6.130.0000.06321.05
5.6.120.0100.03721.04
5.6.110.0100.07021.00
5.6.100.0200.06021.05
5.6.90.0030.08321.05
5.6.80.0070.05320.48
5.6.70.0030.03720.53
5.6.60.0100.07020.34
5.6.50.0000.07320.48
5.6.40.0000.08320.41
5.6.30.0070.05020.43
5.6.20.0030.07020.32
5.6.10.0100.06320.32
5.6.00.0200.06320.39
5.5.380.0030.08320.50
5.5.370.0070.06720.38
5.5.360.0130.07320.41
5.5.350.0000.07320.38
5.5.340.0100.07320.90
5.5.330.0070.08320.88
5.5.320.0070.08020.66
5.5.310.0100.07320.88
5.5.300.0070.07720.81
5.5.290.0100.07720.77
5.5.280.0100.07720.89
5.5.270.0100.07320.86
5.5.260.0030.08320.84
5.5.250.0070.08020.70
5.5.240.0100.03720.14
5.5.230.0100.07020.29
5.5.220.0070.05720.29
5.5.210.0070.06720.31
5.5.200.0030.08020.01
5.5.190.0030.07020.01
5.5.180.0000.08320.19
5.5.160.0070.07720.22
5.5.150.0000.04720.25
5.5.140.0030.08019.97
5.5.130.0070.04320.22
5.5.120.0070.07720.15
5.5.110.0130.07720.25
5.5.100.0030.08320.17
5.5.90.0100.07020.11
5.5.80.0100.05320.11
5.5.70.0070.04719.95
5.5.60.0070.08020.01
5.5.50.0030.09020.07
5.5.40.0070.04020.16
5.5.30.0070.07720.10
5.5.20.0100.07320.01
5.5.10.0000.07720.13
5.5.00.0070.07020.02
5.4.450.0030.06019.46
5.4.440.0130.07019.22
5.4.430.0030.08019.14
5.4.420.0030.07019.14
5.4.410.0070.06319.35
5.4.400.0070.06319.04
5.4.390.0030.08318.96
5.4.380.0030.06318.80
5.4.370.0070.07019.12
5.4.360.0100.06719.16
5.4.350.0030.07319.04
5.4.340.0070.04719.16
5.4.320.0030.03718.96
5.4.310.0030.03718.98
5.4.300.0070.07718.99
5.4.290.0100.07318.89
5.4.280.0000.06718.97
5.4.270.0100.06719.04
5.4.260.0100.06318.79
5.4.250.0070.04019.05
5.4.240.0030.07319.05
5.4.230.0170.06719.15
5.4.220.0070.07018.95
5.4.210.0070.07718.97
5.4.200.0030.06718.83
5.4.190.0000.04719.12
5.4.180.0070.07018.89
5.4.170.0030.06019.00
5.4.160.0030.06318.96
5.4.150.0000.08018.82
5.4.140.0070.07016.37
5.4.130.0000.06716.39
5.4.120.0070.05716.35
5.4.110.0000.04316.32
5.4.100.0070.07316.43
5.4.90.0070.05016.46
5.4.80.0070.05316.48
5.4.70.0030.07716.40
5.4.60.0070.06716.30
5.4.50.0100.07016.43
5.4.40.0070.07016.29
5.4.30.0070.06316.35
5.4.20.0030.03316.36
5.4.10.0000.04016.38
5.4.00.0030.05015.62
5.3.290.0030.03714.68
5.3.280.0170.07014.66
5.3.270.0030.06314.54
5.3.260.0030.07014.55
5.3.250.0030.06714.61
5.3.240.0030.07714.55
5.3.230.0000.07714.67
5.3.220.0030.07714.57
5.3.210.0030.06314.67
5.3.200.0070.07014.51
5.3.190.0030.06714.71
5.3.180.0070.07714.65
5.3.170.0030.07014.71
5.3.160.0030.07314.63
5.3.150.0070.07314.50
5.3.140.0100.08014.68
5.3.130.0030.06314.58
5.3.120.0000.04314.67
5.3.110.0000.05314.54
5.3.100.0030.06714.26
5.3.90.0100.06014.26
5.3.80.0070.07314.26
5.3.70.0030.06714.26
5.3.60.0030.07314.26
5.3.50.0030.07014.26
5.3.40.0030.06314.26
5.3.30.0030.06314.26
5.3.20.0000.07314.26
5.3.10.0030.07314.26
5.3.00.0070.06014.26

preferences:
36.9 ms | 400 KiB | 5 Q