3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Set demo vars $year = 2012; $months = array(10,11,12); $days = array(01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30); foreach($months AS $month) foreach($days AS $day) if((int)$year && (int)$month && (int)$day && rand(0,100)>15) // Randomize dates, withdraw 15% of them $datesWS[] = new DateTime(implode('-',array($year,$month,$day))); // Push DateTime object to the WebService array // Sort dates usort($datesWS, function ($a, $b){ return $a == $b ? 0 : $a > $b ? 1 : -1; }); $dateIni = count($datesWS)>0 ? reset($datesWS) : 0; // Get first date $dateEnd = count($datesWS)>0 ? end($datesWS) : 0; // Get last date $interval = new DateInterval('P1D'); // Set date interval as 1 day // Generate dates range and Transform iterator to array $datesRange = iterator_to_array(new DatePeriod($dateIni, $interval, $dateEnd)); // Get excluded dates $excludeDates = array_udiff($datesRange, $datesWS, function ($a, $b) { return $a == $b ? 0 : 1; }); // Print array(objects) as array(strings) var_dump(array_values(array_map(function($obj){ return $obj->format('d/m/Y'); },$datesWS))); var_dump(array_values(array_map(function($obj){ return $obj->format('d/m/Y'); },$datesRange))); var_dump(array_values(array_map(function($obj){ return $obj->format('d/m/Y'); },$excludeDates))); ?>

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)
5.6.280.0000.08021.18
5.6.250.0300.06020.58
5.6.240.0200.08720.68
5.6.230.0130.08020.80
5.6.220.0070.08720.70
5.6.210.0100.06720.85
5.6.200.0100.08321.10
5.6.190.0070.08721.13
5.6.180.0130.08721.12
5.6.170.0130.08021.17
5.6.160.0070.08021.10
5.6.150.0030.07021.25
5.6.140.0200.05021.20
5.6.130.0100.08021.11
5.6.120.0270.07320.98
5.6.110.0130.06321.02
5.6.100.0130.07321.02
5.6.90.0100.08021.24
5.6.80.0100.08020.52
5.6.70.0030.04720.48
5.6.60.0100.03720.48
5.6.50.0030.04320.47
5.6.40.0000.05020.61
5.6.30.0030.05020.61
5.6.20.0000.04320.43
5.6.10.0000.04320.54
5.6.00.0100.03320.50
5.5.380.0100.08020.48
5.5.370.0030.08720.48
5.5.360.0100.06720.49
5.5.350.0070.08020.56
5.5.340.0230.07020.73
5.5.330.0200.05020.96
5.5.320.0100.06020.98
5.5.310.0000.08020.92
5.5.300.0070.08321.00
5.5.290.0170.07720.87
5.5.280.0100.08020.98
5.5.270.0100.08020.95
5.5.260.0070.09020.98
5.5.250.0130.07320.82
5.5.240.0200.07720.31
5.5.230.0130.03320.39
5.5.220.0030.04020.27
5.5.210.0000.05020.11
5.5.200.0170.03320.32
5.5.190.0170.03020.27
5.5.180.0070.03720.27
5.5.160.0100.05020.36
5.5.150.0000.05020.33
5.5.140.0070.04020.36
5.5.130.0000.04020.21
5.5.120.0070.03720.27
5.5.110.0030.04320.30
5.5.100.0030.04320.05
5.5.90.0070.03320.16
5.5.80.0070.03320.21
5.5.70.0030.04320.15
5.5.60.0000.04720.23
5.5.50.0070.04020.15
5.5.40.0000.04320.14
5.5.30.0130.05320.08
5.5.20.0070.03720.21
5.5.10.0100.07720.12
5.5.00.0070.04720.13
5.4.450.0130.07019.48
5.4.440.0070.08719.39
5.4.430.0000.09019.49
5.4.420.0070.08019.34
5.4.410.0070.08719.41
5.4.400.0070.05019.22
5.4.390.0070.06719.16
5.4.380.0070.04319.27
5.4.370.0070.03719.06
5.4.360.0000.05019.13
5.4.350.0030.04719.18
5.4.340.0100.07019.20
5.4.320.0030.04018.95
5.4.310.0030.04018.86
5.4.300.0030.04019.16
5.4.290.0030.03718.92
5.4.280.0000.04018.91
5.4.270.0070.06319.20
5.4.260.0000.04319.08
5.4.250.0070.04319.07
5.4.240.0130.07719.05
5.4.230.0030.04019.07
5.4.220.0000.04719.20
5.4.210.0070.03319.16
5.4.200.0000.04319.08
5.4.190.0070.03718.88
5.4.180.0000.04718.88
5.4.170.0100.03318.97
5.4.160.0000.06019.23
5.4.150.0030.07318.84
5.4.140.0070.08016.30
5.4.130.0130.06316.55
5.4.120.0030.08016.52
5.4.110.0170.06716.48
5.4.100.0170.06716.66
5.4.90.0070.07316.52
5.4.80.0170.06716.47
5.4.70.0070.06716.58
5.4.60.0070.07716.43
5.4.50.0070.06716.46
5.4.40.0100.07016.44
5.4.30.0100.06316.50
5.4.20.0100.07316.53
5.4.10.0170.06316.42
5.4.00.0170.07015.88
5.3.290.0030.04314.88
5.3.280.0070.04314.73
5.3.270.0000.06014.77
5.3.260.0070.07014.86
5.3.250.0070.06714.73
5.3.240.0200.06714.84
5.3.230.0070.06014.85
5.3.220.0030.05014.83
5.3.210.0100.06314.79
5.3.200.0070.04714.65
5.3.190.0030.08314.76
5.3.180.0130.07014.70
5.3.170.0130.07014.82
5.3.160.0000.08714.83
5.3.150.0030.08314.83
5.3.140.0070.07714.65
5.3.130.0070.07714.78
5.3.120.0130.04314.72
5.3.110.0130.07714.83
5.3.100.0000.06014.12
5.3.90.0000.06014.14
5.3.80.0100.08014.23
5.3.70.0100.07314.21
5.3.60.0070.07714.24
5.3.50.0070.07714.14
5.3.40.0130.07714.20
5.3.30.0070.06714.04
5.3.20.0130.06713.75
5.3.10.0000.07313.84
5.3.00.0130.06713.95
5.2.170.0070.06011.22
5.2.160.0030.05311.22
5.2.150.0170.05011.22
5.2.140.0100.03711.22
5.2.130.0070.05711.22
5.2.120.0070.05011.22
5.2.110.0030.05311.22
5.2.100.0070.06011.22
5.2.90.0070.06011.22
5.2.80.0030.05011.22
5.2.70.0030.04311.22
5.2.60.0000.06311.22
5.2.50.0070.05711.22
5.2.40.0070.04311.22
5.2.30.0030.06711.22
5.2.20.0030.04711.22
5.2.10.0130.05011.22
5.2.00.0000.05711.22
5.1.60.0070.05311.22
5.1.50.0030.05311.22
5.1.40.0100.04711.22
5.1.30.0030.04011.22
5.1.20.0070.04311.22
5.1.10.0070.05011.22
5.1.00.0130.04311.22
5.0.50.0070.04311.22
5.0.40.0100.03711.22
5.0.30.0070.05711.22
5.0.20.0000.03711.22
5.0.10.0100.03711.22
5.0.00.0030.06311.22
4.4.90.0000.02011.22
4.4.80.0070.03711.22
4.4.70.0070.03311.22
4.4.60.0000.02711.22
4.4.50.0030.03311.22
4.4.40.0030.04711.22
4.4.30.0030.02711.22
4.4.20.0000.03711.22
4.4.10.0070.01311.22
4.4.00.0000.05311.22
4.3.110.0030.03311.22
4.3.100.0070.03011.22
4.3.90.0030.03311.22
4.3.80.0000.05311.22
4.3.70.0000.02011.22
4.3.60.0000.03711.22
4.3.50.0000.04011.22
4.3.40.0100.04011.22
4.3.30.0030.03311.22
4.3.20.0030.03711.22
4.3.10.0030.02311.22
4.3.00.0000.01711.22

preferences:
136.57 ms | 1398 KiB | 7 Q