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; for($j = $i+1;$j < sizeof($incidents);$j++) { if(strtotime($incidents[$i]['end']) < strtotime($incidents[$j]['start'])) { if($push) { array_push($uptime, ['start' => $incidents[$i]['end'], 'end' => $incidents[$j]['start']]); } break; } else { $push = false; } } // Saving for last period if(strtotime($incidents[$i]['end']) > strtotime($last_end)) { $last_end = $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.70.0210.00016.75
8.3.60.0150.00016.63
8.3.50.0090.01321.21
8.3.40.0140.00719.01
8.3.30.0030.01218.66
8.3.20.0030.00618.90
8.3.10.0030.00621.95
8.3.00.0040.00421.85
8.2.180.0060.00816.75
8.2.170.0180.00322.96
8.2.160.0110.00422.29
8.2.150.0030.00524.18
8.2.140.0040.00424.66
8.2.130.0040.00419.95
8.2.120.0040.00426.35
8.2.110.0060.00320.52
8.2.100.0120.00017.97
8.2.90.0040.00418.18
8.2.80.0000.00817.97
8.2.70.0030.00518.16
8.2.60.0050.00317.93
8.2.50.0030.00618.34
8.2.40.0040.00420.59
8.2.30.0040.00419.39
8.2.20.0040.00418.09
8.2.10.0000.00718.24
8.2.00.0080.00017.89
8.1.280.0140.00725.92
8.1.270.0080.00023.96
8.1.260.0000.00728.09
8.1.250.0000.00828.09
8.1.240.0090.00022.14
8.1.230.0080.00420.39
8.1.220.0040.00417.77
8.1.210.0040.00418.77
8.1.200.0030.00617.48
8.1.190.0040.00417.48
8.1.180.0040.00418.10
8.1.170.0040.00418.66
8.1.160.0000.00723.91
8.1.150.0000.00820.73
8.1.140.0070.00019.67
8.1.130.0040.00417.79
8.1.120.0050.00317.70
8.1.110.0050.00317.68
8.1.100.0000.00817.60
8.1.90.0040.00417.74
8.1.80.0000.00717.61
8.1.70.0040.00417.52
8.1.60.0030.00617.71
8.1.50.0040.00417.58
8.1.40.0080.00017.68
8.1.30.0040.00417.71
8.1.20.0090.00017.65
8.1.10.0040.00417.72
8.1.00.0040.00717.68
8.0.300.0000.00719.77
8.0.290.0070.00016.88
8.0.280.0030.00318.53
8.0.270.0000.00817.39
8.0.260.0040.00417.38
8.0.250.0030.00317.15
8.0.240.0030.00517.07
8.0.230.0000.00717.14
8.0.220.0000.00717.01
8.0.210.0070.00017.11
8.0.200.0060.00017.19
8.0.190.0030.00517.06
8.0.180.0060.00317.11
8.0.170.0050.00317.02
8.0.160.0070.00017.18
8.0.150.0070.00317.12
8.0.140.0000.00717.07
8.0.130.0030.00313.45
8.0.120.0040.00417.05
8.0.110.0050.00317.02
8.0.100.0060.00316.96
8.0.90.0050.00317.05
8.0.80.0130.00317.08
8.0.70.0000.00717.00
8.0.60.0050.00217.14
8.0.50.0000.00717.05
8.0.30.0070.01117.22
8.0.20.0070.01217.40
8.0.10.0040.00417.17
8.0.00.0100.00616.84
7.4.330.0000.00515.55
7.4.320.0000.00616.66
7.4.300.0000.00616.76
7.4.290.0030.00316.64
7.4.280.0000.00916.73
7.4.270.0000.00716.52
7.4.260.0000.01116.54
7.4.250.0030.00316.70
7.4.240.0040.00416.64
7.4.230.0030.00316.73
7.4.220.0110.01516.76
7.4.210.0070.01316.66
7.4.200.0070.00016.63
7.4.160.0100.00816.74
7.4.150.0040.01317.40
7.4.140.0090.00817.86
7.4.130.0120.00816.80
7.4.120.0110.00616.64
7.4.110.0090.00916.65
7.4.100.0100.00716.68
7.4.90.0120.00616.80
7.4.80.0070.01019.39
7.4.70.0090.00916.82
7.4.60.0100.00616.72
7.4.50.0120.00316.76
7.4.40.0210.00016.77
7.4.30.0070.01016.46
7.4.00.0050.01215.16
7.3.330.0030.00313.30
7.3.320.0030.00313.27
7.3.310.0000.00716.33
7.3.300.0030.00316.53
7.3.290.0070.00916.48
7.3.280.0080.01216.51
7.3.270.0150.00317.40
7.3.260.0060.01116.52
7.3.250.0080.01316.59
7.3.240.0100.01016.83
7.3.230.0130.00316.84
7.3.210.0070.01416.56
7.3.200.0130.00316.70
7.3.190.0140.00316.59
7.3.180.0100.00716.53
7.3.170.0120.00616.50
7.3.160.0090.00916.72
7.3.120.0140.00015.09
7.3.110.0030.01415.03
7.3.100.0080.00814.81
7.3.90.0070.00314.71
7.3.80.0050.00515.01
7.3.70.0110.00014.69
7.3.60.0060.01015.02
7.3.50.0110.00015.16
7.3.40.0040.01114.98
7.3.30.0070.01015.17
7.3.20.0110.00717.00
7.3.10.0100.00716.95
7.3.00.0000.01416.55
7.2.330.0040.01416.55
7.2.320.0060.01116.57
7.2.310.0090.01217.07
7.2.300.0090.00916.73
7.2.290.0030.01416.63
7.2.250.0030.01315.18
7.2.240.0030.01715.30
7.2.230.0060.00915.13
7.2.220.0100.00715.55
7.2.210.0040.01114.98
7.2.200.0030.01415.38
7.2.190.0060.00314.85
7.2.180.0040.00815.16
7.2.170.0000.01414.92
7.2.00.0000.01219.36
7.1.330.0030.01416.05
7.1.320.0040.01116.02
7.1.310.0070.00416.12
7.1.300.0000.00915.84
7.1.290.0080.00316.00
7.1.280.0030.01016.01
7.1.270.0060.00615.71
7.1.260.0120.00016.02
7.1.70.0050.00217.53
7.1.60.0030.01017.10
7.1.00.0070.07022.32
7.0.200.0520.00714.95
7.0.120.0130.07022.01
7.0.110.0030.06021.98
7.0.100.0100.05722.20
7.0.90.0100.06022.11
7.0.80.0100.05722.05
7.0.70.0100.05322.06
7.0.60.0070.06322.07
7.0.50.0130.06021.99
7.0.40.0070.06322.05
7.0.30.0130.05322.11
7.0.20.0070.07022.10
7.0.10.0130.05022.09
7.0.00.0070.08322.03
5.6.270.0130.06320.84
5.6.260.0070.05720.89
5.6.250.0030.06020.87
5.6.240.0130.05321.06
5.6.230.0000.06720.83
5.6.220.0030.06021.09
5.6.210.0100.06720.95
5.6.200.0070.07021.09
5.6.190.0070.05720.83
5.6.180.0070.05721.04
5.6.170.0070.06721.00
5.6.160.0030.05721.01
5.6.150.0030.06020.87
5.6.140.0170.06020.79
5.6.130.0070.05720.83
5.6.120.0200.06720.88
5.6.110.0200.07321.03
5.6.100.0100.07320.99
5.6.90.0130.06320.86
5.6.80.0100.07020.39
5.6.70.0130.04720.38
5.6.60.0100.05720.20
5.6.50.0130.06020.42
5.6.40.0100.05020.21
5.6.30.0130.04720.21
5.6.20.0070.05320.36
5.6.10.0070.05020.37
5.6.00.0030.05320.39

preferences:
53.21 ms | 401 KiB | 5 Q