3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = [ [ 'ID' => 16, 'begin_date' => new \DateTime('2016-01-01 UTC'), 'end_date' => new \DateTime('2016-11-30 UTC'), ], [ 'ID' => 33, 'begin_date' => new \DateTime('2015-01-04 UTC'), 'end_date' => new \DateTime('2016-02-29 UTC'), ], ]; // for programs that run over multiple seconds this makes sure we don't drift during sorting $now = new \DateTime('now'); usort($data, function($a, $b) { // Note PHP 7 <=> doesn't work on \DateTime if($a['end_date'] == $b['end_date']) { return 0; } return $a['end_date'] > $b['end_date'] ? 1 : -1; }); var_dump($now); var_dump($data); // pick the first element that meets the criteria foreach($data as $index => $element) { if($element['begin_date'] < $now) { // first condition is invalidated echo "begin_date invalidated ID #".$element['ID'].PHP_EOL; continue; } else { var_dump($element); } }

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.0130.00616.88
8.3.50.0080.01021.34
8.3.40.0070.01318.92
8.3.30.0070.00718.79
8.3.20.0040.00420.33
8.3.10.0060.00321.90
8.3.00.0040.00421.73
8.2.180.0070.00716.75
8.2.170.0070.00722.96
8.2.160.0150.00420.33
8.2.150.0040.00425.66
8.2.140.0040.00424.66
8.2.130.0000.00821.07
8.2.120.0090.00026.35
8.2.110.0090.00021.00
8.2.100.0090.00318.05
8.2.90.0080.00019.30
8.2.80.0080.00017.97
8.2.70.0000.00917.50
8.2.60.0030.00517.93
8.2.50.0040.00418.09
8.2.40.0030.00622.36
8.2.30.0050.00519.47
8.2.20.0090.00018.02
8.2.10.0040.00418.26
8.2.00.0030.00618.32
8.1.280.0040.01125.92
8.1.270.0090.00023.99
8.1.260.0030.00528.09
8.1.250.0000.00828.09
8.1.240.0100.00022.05
8.1.230.0070.00319.16
8.1.220.0050.00317.77
8.1.210.0030.00518.77
8.1.200.0030.00617.48
8.1.190.0030.00517.48
8.1.180.0000.00818.10
8.1.170.0000.00818.66
8.1.160.0000.00820.72
8.1.150.0030.00520.64
8.1.140.0060.00319.57
8.1.130.0070.00017.84
8.1.120.0040.00417.58
8.1.110.0030.00717.55
8.1.100.0040.00417.57
8.1.90.0000.00717.65
8.1.80.0080.00017.63
8.1.70.0040.00417.64
8.1.60.0080.00017.74
8.1.50.0000.00917.73
8.1.40.0040.00417.64
8.1.30.0060.00317.80
8.1.20.0000.00817.79
8.1.10.0040.00417.65
8.1.00.0050.00317.60
8.0.300.0070.00018.77
8.0.290.0000.00916.88
8.0.280.0070.00018.53
8.0.270.0040.00417.35
8.0.260.0040.00417.34
8.0.250.0040.00417.08
8.0.240.0070.00017.05
8.0.230.0000.00817.19
8.0.220.0030.00516.97
8.0.210.0000.00717.11
8.0.200.0040.00417.08
8.0.190.0040.00417.16
8.0.180.0040.00417.11
8.0.170.0030.00617.04
8.0.160.0040.00417.00
8.0.150.0000.00816.93
8.0.140.0070.00017.05
8.0.130.0050.00013.41
8.0.120.0030.00516.98
8.0.110.0000.00717.07
8.0.100.0040.00417.08
8.0.90.0070.00017.02
8.0.80.0070.00717.11
8.0.70.0040.00416.94
8.0.60.0040.00416.93
8.0.50.0050.00217.15
8.0.30.0120.00917.35
8.0.20.0140.00817.41
8.0.10.0050.00317.04
8.0.00.0130.00816.98
7.4.330.0000.00516.67
7.4.320.0030.00316.68
7.4.300.0070.00016.70
7.4.290.0030.00316.60
7.4.280.0030.00616.66
7.4.270.0040.00416.71
7.4.260.0050.00316.75
7.4.250.0050.00216.61
7.4.240.0050.00216.55
7.4.230.0040.00416.75
7.4.220.0090.00616.87
7.4.210.0070.01316.79
7.4.200.0000.00716.75
7.4.160.0120.00616.65
7.4.150.0260.02617.40
7.4.140.0170.00517.86
7.4.130.0120.00816.72
7.4.120.0150.00416.72
7.4.110.0120.00416.62
7.4.100.0130.01016.59
7.4.90.0150.01216.63
7.4.80.0060.01519.39
7.4.70.0060.01216.65
7.4.60.0070.01016.65
7.4.50.0090.00616.51
7.4.40.0080.01116.51
7.4.30.0180.00016.68
7.4.00.0000.01515.07
7.3.330.0000.00713.34
7.3.320.0000.00713.36
7.3.310.0050.00316.59
7.3.300.0000.00616.42
7.3.290.0050.00916.48
7.3.280.0100.01016.46
7.3.270.0170.00317.40
7.3.260.0100.01016.66
7.3.250.0130.00616.77
7.3.240.0160.00416.67
7.3.230.0110.01216.75
7.3.210.0140.01016.55
7.3.200.0070.01719.39
7.3.190.0090.01416.76
7.3.180.0100.01316.69
7.3.170.0090.01216.49
7.3.160.0130.00316.53
7.2.330.0090.00917.03
7.2.320.0080.01216.90
7.2.310.0150.00316.91
7.2.300.0150.00416.82
7.2.290.0160.00617.02
7.2.80.0070.00716.93
7.2.60.0080.00817.09
7.2.00.0060.00619.72
7.1.200.0040.00415.83
7.1.100.0000.01218.39
7.1.70.0060.00317.44
7.1.60.0070.01719.40
7.1.50.0060.01617.15
7.1.00.0070.07322.25
7.0.200.0000.01017.08
7.0.60.0000.03721.63
7.0.50.0030.05317.90
7.0.40.0130.05320.30
7.0.30.0330.07720.07
7.0.20.0230.06320.25
7.0.10.0070.05320.23
7.0.00.0070.05320.22
5.6.280.0030.03021.14
5.6.210.0030.08720.70
5.6.200.0070.03718.20
5.6.190.0030.04720.40
5.6.180.0230.05020.46
5.6.170.0370.07720.46
5.6.160.0130.07720.54
5.6.150.0130.06718.20
5.6.140.0100.08718.17
5.6.130.0170.06718.18
5.6.120.0070.05321.10
5.6.110.0030.09020.97
5.6.100.0070.08321.11
5.6.90.0070.08721.10
5.6.80.0170.07320.44
5.5.350.2570.03720.45
5.5.340.0130.04717.96
5.5.330.0000.04720.27
5.5.320.0330.06020.35
5.5.310.0270.05020.35
5.5.300.0030.04017.98
5.5.290.0070.07718.04
5.5.280.0030.04320.74
5.5.270.0070.05320.96
5.5.260.0030.07020.80
5.5.250.0200.06720.69
5.5.240.0300.06020.04

preferences:
55.23 ms | 401 KiB | 5 Q