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('2016-01-04 UTC'), 'end_date' => new \DateTime('2016-02-29 UTC'), ], ]; // assume length >= 1 w/ previous validation // keep track of the in-progress leading element, assuming the first is leading to begin with $currentLeading = $data[0]; foreach($data as $index => $element) { if($element['begin_date'] > strtotime('now')) { // first condition is true if ($index == 0) { echo "Error: Element cannot be the leading element"; // more likely return false if wrapped in a validation function } if($element['end_date'] > strtotime('now')) { if ($element['end_date'] > $currentLeading['end_date']) { $currentLeading = $element; } } } } var_dump($currentLeading);

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.0110.01416.88
8.3.50.0110.01121.12
8.3.40.0120.00318.95
8.3.30.0100.01318.84
8.3.20.0040.00420.18
8.3.10.0080.00023.65
8.3.00.0040.00421.86
8.2.180.0140.00416.88
8.2.170.0140.00722.96
8.2.160.0140.00020.57
8.2.150.0030.00524.18
8.2.140.0080.00024.66
8.2.130.0080.00021.05
8.2.120.0060.00326.35
8.2.110.0070.00319.33
8.2.100.0080.00417.97
8.2.90.0040.00419.22
8.2.80.0030.00517.97
8.2.70.0060.00317.63
8.2.60.0060.00318.05
8.2.50.0030.00518.07
8.2.40.0060.00322.15
8.2.30.0040.00419.64
8.2.20.0100.00017.95
8.2.10.0040.00418.32
8.2.00.0030.00618.18
8.1.280.0070.01425.92
8.1.270.0150.00422.19
8.1.260.0040.00428.09
8.1.250.0000.00828.09
8.1.240.0070.00321.43
8.1.230.0040.00817.70
8.1.220.0080.00017.74
8.1.210.0040.00418.77
8.1.200.0080.00417.60
8.1.190.0060.00317.47
8.1.180.0000.00818.10
8.1.170.0000.00818.67
8.1.160.0050.00320.84
8.1.150.0040.00420.73
8.1.140.0030.00519.64
8.1.130.0070.00017.69
8.1.120.0040.00417.65
8.1.110.0070.00317.63
8.1.100.0000.00717.55
8.1.90.0060.00317.54
8.1.80.0070.00017.70
8.1.70.0000.00717.65
8.1.60.0080.00017.76
8.1.50.0060.00317.68
8.1.40.0040.00417.66
8.1.30.0050.00317.70
8.1.20.0040.00417.80
8.1.10.0060.00317.61
8.1.00.0020.00517.72
8.0.300.0040.00418.77
8.0.290.0000.00716.88
8.0.280.0080.00018.53
8.0.270.0050.00217.32
8.0.260.0030.00317.29
8.0.250.0000.00717.19
8.0.240.0030.00317.07
8.0.230.0000.00717.28
8.0.220.0060.00317.14
8.0.210.0040.00417.04
8.0.200.0060.00017.29
8.0.190.0030.00617.27
8.0.180.0040.00417.18
8.0.170.0040.00417.18
8.0.160.0080.00017.21
8.0.150.0040.00417.09
8.0.140.0040.00417.00
8.0.130.0060.00013.42
8.0.120.0080.00017.14
8.0.110.0000.00817.19
8.0.100.0000.00717.20
8.0.90.0040.00417.13
8.0.80.0090.00617.12
8.0.70.0000.00717.04
8.0.60.0080.00017.05
8.0.50.0040.00417.20
8.0.30.0110.00817.39
8.0.20.0130.01417.40
8.0.10.0040.00417.29
8.0.00.0090.01117.12
7.4.330.0000.00516.77
7.4.320.0070.00016.55
7.4.300.0050.00316.70
7.4.290.0070.00016.66
7.4.280.0070.00016.74
7.4.270.0030.00316.73
7.4.260.0110.00016.77
7.4.250.0030.00516.73
7.4.240.0050.00316.60
7.4.230.0000.00616.65
7.4.220.0130.00316.77
7.4.210.0090.00916.68
7.4.200.0000.00716.77
7.4.160.0160.00016.61
7.4.150.0130.00717.40
7.4.140.0110.01217.86
7.4.130.0110.00916.64
7.4.120.0080.01016.68
7.4.110.0100.00716.59
7.4.100.0130.00616.77
7.4.90.0150.00316.82
7.4.80.0150.00419.39
7.4.70.0110.00716.71
7.4.60.0050.01416.63
7.4.50.0000.01216.75
7.4.40.0060.01116.91
7.4.30.0100.01316.75
7.4.00.0170.00015.28
7.3.330.0070.00013.25
7.3.320.0040.00413.27
7.3.310.0000.00716.64
7.3.300.0030.00316.52
7.3.290.0060.01116.49
7.3.280.0100.00816.53
7.3.270.0090.00917.40
7.3.260.0150.00316.63
7.3.250.0120.00816.71
7.3.240.0080.01216.65
7.3.230.0110.00816.48
7.3.210.0120.00616.62
7.3.200.0090.01216.66
7.3.190.0060.01516.60
7.3.180.0130.01016.59
7.3.170.0030.01716.69
7.3.160.0070.01016.59
7.3.10.0110.00316.89
7.3.00.0030.01216.67
7.2.330.0130.01016.97
7.2.320.0150.00317.01
7.2.310.0100.00716.79
7.2.300.0070.01016.68
7.2.290.0100.00716.80
7.2.130.0060.00916.66
7.2.120.0090.00617.05
7.2.110.0040.01116.93
7.2.100.0060.00916.71
7.2.90.0120.00317.10
7.2.80.0110.00017.27
7.2.70.0000.01117.05
7.2.60.0030.01017.17
7.2.50.0070.00717.05
7.2.40.0110.00017.06
7.2.30.0000.01517.07
7.2.20.0000.01216.89
7.2.10.0060.00617.27
7.2.00.0030.00618.41
7.1.250.0070.00715.93
7.1.100.0150.00918.18
7.1.70.0030.00617.45
7.1.60.0040.01119.40
7.1.50.0110.01117.11
7.1.00.0070.07322.45
7.0.200.0030.00616.96
7.0.60.0030.06021.59
7.0.50.0000.04717.92
7.0.40.0030.05719.90
7.0.30.0370.04020.34
7.0.20.0370.05020.19
7.0.10.0070.09020.06
7.0.00.0100.08320.04
5.6.280.0070.07021.13
5.6.210.0070.03720.64
5.6.200.0100.04718.15
5.6.190.0100.06020.42
5.6.180.0330.05020.45
5.6.170.0270.08320.33
5.6.160.0130.04720.44
5.6.150.0130.04018.13
5.6.140.0100.07318.07
5.6.130.0000.05718.18
5.6.120.0070.06320.98
5.6.110.0030.05020.97
5.6.100.0130.07720.88
5.6.90.0000.06020.97
5.6.80.0100.07720.50
5.5.350.4230.03720.41
5.5.340.0130.06718.02
5.5.330.0030.07720.23
5.5.320.0330.04320.20
5.5.310.0100.05320.30
5.5.300.0100.08318.02
5.5.290.0100.03717.97
5.5.280.0130.04720.87
5.5.270.0130.07720.92
5.5.260.0100.08320.79
5.5.250.0100.07720.66
5.5.240.0270.04320.28

preferences:
50.4 ms | 404 KiB | 6 Q