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)
8.3.60.0170.00318.48
8.3.50.0130.00622.05
8.3.40.0040.01118.98
8.3.30.0040.01118.97
8.3.20.0040.00418.91
8.3.10.0040.00421.08
8.3.00.0000.00821.73
8.2.180.0110.00416.63
8.2.170.0190.00322.96
8.2.160.0110.00420.40
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0000.00826.16
8.2.120.0080.00019.81
8.2.110.0040.00819.38
8.2.100.0050.00517.84
8.2.90.0000.00819.26
8.2.80.0000.00817.97
8.2.70.0030.00617.48
8.2.60.0050.00517.68
8.2.50.0000.00818.07
8.2.40.0000.00817.97
8.2.30.0070.00021.28
8.2.20.0060.00317.64
8.2.10.0070.00017.81
8.2.00.0030.00517.78
8.1.280.0040.01125.92
8.1.270.0040.00423.99
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0030.00622.38
8.1.230.0030.00920.90
8.1.220.0000.00818.77
8.1.210.0030.00518.85
8.1.200.0090.00017.48
8.1.190.0060.00317.66
8.1.180.0030.00518.10
8.1.170.0060.00318.59
8.1.160.0040.00418.91
8.1.150.0000.00818.67
8.1.140.0040.00417.52
8.1.130.0000.00717.86
8.1.120.0000.00717.55
8.1.110.0040.00417.61
8.1.100.0030.00517.44
8.1.90.0050.00217.60
8.1.80.0030.00517.55
8.1.70.0030.00317.48
8.1.60.0000.00817.65
8.1.50.0030.00617.55
8.1.40.0090.00017.46
8.1.30.0000.00817.57
8.1.20.0090.00017.68
8.1.10.0030.00517.50
8.1.00.0050.00317.55
8.0.300.0000.00719.97
8.0.290.0000.00817.16
8.0.280.0030.00318.48
8.0.270.0040.00417.21
8.0.260.0000.00717.03
8.0.250.0040.00417.05
8.0.240.0070.00317.09
8.0.230.0000.00717.06
8.0.220.0030.00616.93
8.0.210.0030.00316.96
8.0.200.0030.00316.91
8.0.190.0050.00317.08
8.0.180.0000.00717.00
8.0.170.0090.00016.93
8.0.160.0000.00816.88
8.0.150.0070.00016.92
8.0.140.0090.00016.97
8.0.130.0030.00313.50
8.0.120.0000.00716.97
8.0.110.0000.00716.86
8.0.100.0050.00217.05
8.0.90.0040.00416.87
8.0.80.0120.00316.97
8.0.70.0050.00316.97
8.0.60.0080.00016.99
8.0.50.0030.00617.00
8.0.30.0080.01117.08
8.0.20.0100.01417.40
8.0.10.0080.00017.23
8.0.00.0040.01816.76
7.4.330.0000.00514.77
7.4.320.0030.00316.68
7.4.300.0030.00316.45
7.4.290.0040.00416.54
7.4.280.0030.00316.54
7.4.270.0040.00416.70
7.4.260.0030.00313.29
7.4.250.0050.00216.46
7.4.240.0080.00016.50
7.4.230.0030.00316.64
7.4.220.0010.02116.67
7.4.210.0090.00816.66
7.4.200.0070.00016.66
7.4.190.0040.00416.59
7.4.160.0080.00816.54
7.4.150.0110.01517.40
7.4.140.0100.00817.86
7.4.130.0070.01416.71
7.4.120.0070.01016.58
7.4.110.0110.00516.42
7.4.100.0140.00316.57
7.4.90.0030.02016.63
7.4.80.0120.00919.39
7.4.70.0070.01016.33
7.4.60.0130.00316.55
7.4.50.0040.00416.72
7.4.40.0000.01622.52
7.4.30.0070.01016.57
7.3.330.0020.00213.41
7.3.320.0030.00313.39
7.3.310.0040.00416.49
7.3.300.0000.00716.45
7.3.290.0090.00616.40
7.3.280.0030.01416.42
7.3.270.0080.01117.40
7.3.260.0110.00818.24
7.3.250.0070.01116.68
7.3.240.0130.01016.59
7.3.230.0070.01016.56
7.3.210.0070.01316.47
7.3.200.0110.00719.39
7.3.190.0110.01116.59
7.3.180.0060.01116.42
7.3.170.0090.01216.46
7.3.160.0130.01016.65
7.2.330.0170.00016.53
7.2.320.0130.00616.81
7.2.310.0130.00716.67
7.2.300.0090.00616.78
7.2.290.0070.01016.82
7.2.100.1310.00714.95
7.2.90.1100.00314.73
7.2.80.1330.00314.73
7.2.70.0180.00415.16
7.2.60.0060.01315.02
7.2.50.0720.00414.94
7.2.40.0770.00714.96
7.2.30.0240.00914.70
7.1.220.0990.00614.04
7.1.210.0520.00413.93
7.1.200.0180.00413.93
7.1.190.0000.01413.88
7.1.180.1950.00313.75
7.1.170.0130.00614.05
7.1.160.0520.00313.81
7.1.150.1260.00713.46
7.0.310.1060.00313.66
7.0.300.0250.01413.66
7.0.290.1650.00613.58
7.0.280.0960.00413.73
5.6.380.0040.01314.72
5.6.370.0080.00814.41
5.6.360.0040.00814.20
5.6.350.0040.00814.55
5.6.340.0060.00714.01

preferences:
61.3 ms | 401 KiB | 5 Q