3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* This is the result i want from $uptime, all periods where there are no incidents between period_start and period_end. -------------------------------------------------- Array ( [0] => Array ( [start] => 2016-01-01 00:00:00 [end] => 2016-01-05 00:00:00 ) [1] => Array ( [start] => 2016-01-15 22:00:00 [end] => 2016-01-20 00:00:00 ) [2] => Array ( [start] => 2016-01-25 23:59:59 [end] => 2016-01-31 23:59:59 ) ) -------------------------------------------------- */ $period_start = '2016-01-01 00:00:00'; $period_end = '2016-01-31 23:59:59'; $uptime = []; $incidents = [ ['start' => '2016-01-05 00:00:00', 'end' => '2016-01-10 23:59:59'], ['start' => '2016-01-07 00:00:00', 'end' => '2016-01-15 22:00:00'], // overlapping ['start' => '2016-01-08 00:00:00', 'end' => '2016-01-12 23:59:59'], // overlapping ['start' => '2016-01-20 00:00:00', 'end' => '2016-01-25 23:59:59'], ['start' => '2016-01-23 00:00:00', 'end' => '2016-01-24 23:59:59'] // overlapping ]; // First period if(strtotime($period_start) <= strtotime($incidents[0]['start'])) { array_push($uptime, ['start' => $period_start, 'end' => $incidents[0]['start']]); } $last_end = 0; // Used for finding the last ending incident. for($i = 0;$i < sizeof($incidents);$i++) { $push = true; $last_end_j = $incidents[$i]['end']; for($j = $i+1;$j < sizeof($incidents);$j++) { if(strtotime($incidents[$i]['end']) < strtotime($incidents[$j]['start'])) { if(strtotime($incidents[$j]['end']) > strtotime($last_end_j)) { $last_end_j = $incidents[$j]['end']; } if($push) { array_push($uptime, ['start' => $last_end_j, 'end' => $incidents[$j]['start']]); } break; } else { $push = false; } } if(strtotime($incidents[$i]['end']) > strtotime($last_end)) { $last_end_j = $incidents[$i]['end']; } } // Last period if(strtotime($period_end) >= strtotime($last_end)) { array_push($uptime, ['start' => $last_end, 'end' => $period_end]); } print_r( $uptime );

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.00316.63
8.3.50.0100.00716.43
8.3.40.0000.01418.76
8.3.30.0110.00418.94
8.3.20.0040.00418.93
8.3.10.0040.00421.73
8.3.00.0000.00721.76
8.2.180.0120.00318.28
8.2.170.0060.00922.96
8.2.160.0100.00322.08
8.2.150.0080.00024.18
8.2.140.0050.00324.66
8.2.130.0040.00419.82
8.2.120.0000.00726.35
8.2.110.0090.00022.25
8.2.100.0140.00017.96
8.2.90.0040.00419.14
8.2.80.0040.00418.05
8.2.70.0040.00417.93
8.2.60.0040.00418.16
8.2.50.0050.00518.10
8.2.40.0080.00020.55
8.2.30.0000.00719.33
8.2.20.0030.00518.22
8.2.10.0050.00218.23
8.2.00.0000.00917.97
8.1.280.0180.00025.92
8.1.270.0000.00823.91
8.1.260.0040.00428.09
8.1.250.0070.00028.09
8.1.240.0070.00319.39
8.1.230.0030.01019.16
8.1.220.0080.00017.91
8.1.210.0030.00518.77
8.1.200.0060.00317.48
8.1.190.0040.00417.47
8.1.180.0080.00018.10
8.1.170.0000.00818.63
8.1.160.0050.00323.92
8.1.150.0000.00820.61
8.1.140.0040.00419.68
8.1.130.0000.00717.80
8.1.120.0040.00417.70
8.1.110.0060.00317.68
8.1.100.0000.00717.59
8.1.90.0050.00317.67
8.1.80.0000.00717.68
8.1.70.0000.00717.68
8.1.60.0000.00817.62
8.1.50.0050.00317.60
8.1.40.0040.00417.71
8.1.30.0000.00817.71
8.1.20.0040.00417.80
8.1.10.0000.00817.61
8.1.00.0060.00617.78
8.0.300.0000.00819.89
8.0.290.0000.00717.13
8.0.280.0000.00718.54
8.0.270.0000.00817.21
8.0.260.0000.00817.37
8.0.250.0070.00017.20
8.0.240.0030.00317.07
8.0.230.0000.00717.19
8.0.220.0040.00417.14
8.0.210.0030.00317.10
8.0.200.0060.00017.14
8.0.190.0080.00017.25
8.0.180.0040.00417.06
8.0.170.0030.00517.11
8.0.160.0000.00717.02
8.0.150.0050.00217.12
8.0.140.0000.00716.98
8.0.130.0030.00313.48
8.0.120.0050.00317.05
8.0.110.0020.00517.10
8.0.100.0000.00717.08
8.0.90.0040.00417.07
8.0.80.0060.00917.09
8.0.70.0000.00717.09
8.0.60.0000.00716.99
8.0.50.0040.00417.09
8.0.30.0060.01217.23
8.0.20.0110.00717.40
8.0.10.0040.00417.29
8.0.00.0140.00416.82
7.4.330.0030.00315.55
7.4.320.0030.00316.57
7.4.300.0030.00316.68
7.4.290.0030.00316.79
7.4.280.0000.00816.57
7.4.270.0030.00316.64
7.4.260.0030.00516.77
7.4.250.0080.00016.75
7.4.240.0070.00016.69
7.4.230.0020.00516.47
7.4.220.0000.01816.78
7.4.210.0030.01616.75
7.4.200.0070.00016.77
7.4.160.0060.00916.65
7.4.150.0090.00917.40
7.4.140.0080.01117.86
7.4.130.0110.00616.74
7.4.120.0100.01016.54
7.4.110.0160.00316.62
7.4.100.0070.01116.61
7.4.90.0110.00616.71
7.4.80.0030.01619.39
7.4.70.0070.01216.52
7.4.60.0130.00316.80
7.4.50.0070.00716.64
7.4.40.0000.01616.67
7.4.30.0100.00616.61
7.4.00.0080.01015.04
7.3.330.0040.00313.28
7.3.320.0000.00613.41
7.3.310.0050.00216.46
7.3.300.0030.00316.32
7.3.290.0130.00316.44
7.3.280.0070.01016.49
7.3.270.0110.00717.40
7.3.260.0130.00416.49
7.3.250.0090.00916.70
7.3.240.0160.00716.71
7.3.230.0070.01016.61
7.3.210.0060.01016.50
7.3.200.0100.00716.50
7.3.190.0100.00716.51
7.3.180.0030.01716.48
7.3.170.0060.01316.52
7.3.160.0090.01216.61
7.3.120.0090.01215.23
7.3.110.0140.00315.13
7.3.100.0070.01115.08
7.3.90.0090.00615.05
7.3.80.0120.00615.04
7.3.70.0000.01415.11
7.3.60.0080.00814.98
7.3.50.0100.00715.19
7.3.40.0070.00714.84
7.3.30.0060.00915.06
7.3.20.0110.00716.58
7.3.10.0060.01116.74
7.3.00.0100.00816.64
7.2.330.0030.01316.75
7.2.320.0090.00916.79
7.2.310.0100.00716.60
7.2.300.0150.00616.93
7.2.290.0170.00016.83
7.2.250.0100.00915.32
7.2.240.0030.01615.16
7.2.230.0120.00415.25
7.2.220.0070.00714.88
7.2.210.0090.00915.57
7.2.200.0160.00015.33
7.2.190.0060.01215.34
7.2.180.0030.01215.00
7.2.170.0030.00615.39
7.2.130.0070.00716.90
7.2.120.0100.01017.03
7.2.110.0080.00816.72
7.2.100.0140.00916.75
7.2.90.0030.01616.99
7.2.80.0110.01116.68
7.2.70.0070.01716.76
7.2.60.0120.00816.76
7.2.50.0120.01116.89
7.2.40.0200.00316.96
7.2.30.0120.00917.09
7.2.20.0150.00616.74
7.2.10.0150.00617.04
7.2.00.0080.00518.20
7.1.330.0090.00615.96
7.1.320.0000.01416.09
7.1.310.0070.01015.75
7.1.300.0060.00915.78
7.1.290.0070.00715.97
7.1.280.0070.00716.08
7.1.270.0100.00715.97
7.1.260.0070.00715.95
7.1.250.0000.01515.84
7.1.200.0060.00615.69
7.1.70.0030.00517.56
7.1.60.0100.00317.42
7.1.00.0070.07322.45
7.0.200.0220.00614.91
7.0.120.0070.07022.12
7.0.110.0070.05722.02
7.0.100.0030.07722.12
7.0.90.0070.05722.21
7.0.80.0030.06021.97
7.0.70.0270.06320.25
7.0.60.0100.05322.03
7.0.50.0100.05322.05
7.0.40.0100.05322.12
7.0.30.0130.07322.05
7.0.20.0170.05322.10
7.0.10.0070.05722.07
7.0.00.0200.05322.18
5.6.270.0130.06321.09
5.6.260.0130.05021.11
5.6.250.0030.07320.97
5.6.240.0100.08320.98
5.6.230.0070.05721.07
5.6.220.0130.05020.96
5.6.210.0000.06020.98
5.6.200.0100.05721.09
5.6.190.0030.06021.00
5.6.180.0200.07021.02
5.6.170.0200.06020.80
5.6.160.0030.06021.09
5.6.150.0100.05320.75
5.6.140.0100.08021.06
5.6.130.0070.08021.09
5.6.120.0070.07320.94
5.6.110.0130.06020.79
5.6.100.0100.06320.93
5.6.90.0130.05321.07
5.6.80.0100.05320.21
5.6.70.0000.06320.21
5.6.60.0100.05720.30
5.6.50.0100.05320.41
5.6.40.0030.06020.19
5.6.30.0270.04320.38
5.6.20.0130.07020.44
5.6.10.0130.06320.39
5.6.00.0130.05720.44

preferences:
66.44 ms | 401 KiB | 5 Q