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,06,07,08,09,11,12,13,14,16,17,18,19,21,22,23,24,26,27,28,29,31); foreach($months AS $month) foreach($days AS $day) $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 var_dump(array_shift($datesWS)); var_dump(array_pop($dateWS)); /* $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->modify( '+1 day' ))); // This way seems to work foreach($datesRange AS $date) { if(!in_array($date->format('d/m/Y'),array_values(array_map(function($obj){ return $obj->format('d/m/Y'); },$datesWS)))) $excludeDates[] = $date->format('d/m/Y'); } // This way should be more efficient, but I'm fed up with it! // Get excluded dates $excludeDates = array_udiff($datesRange, $datesWS, function ($a, $b) { return $a == $b ? 0 : 1; }); // Comment/Uncomment this in order to print this method or the other one // 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.0030.07320.89
5.6.210.0030.04320.48
5.6.200.0000.07018.25
5.6.190.0070.04720.63
5.6.180.0400.06720.62
5.6.170.0430.08020.55
5.6.160.0030.05020.54
5.6.150.0170.07318.23
5.6.140.0030.04018.20
5.6.130.0130.08018.18
5.6.120.0170.03720.99
5.6.110.0070.08321.10
5.6.100.0100.07021.02
5.6.90.0100.08320.95
5.6.80.0100.07720.54
5.6.70.0230.03020.39
5.5.350.0300.04320.31
5.5.340.0130.05318.00
5.5.330.0030.07020.42
5.5.320.0370.06020.32
5.5.310.0230.08020.30
5.5.300.0000.04317.97
5.5.290.0070.08318.06
5.5.280.0030.09020.79
5.5.270.0030.04720.78
5.5.260.0030.09720.80
5.5.250.0200.07720.63
5.5.240.0030.07320.17
5.4.450.0030.05319.50
5.4.440.0030.06319.19
5.4.430.0130.07319.37
5.4.420.0130.05719.46
5.4.410.0070.06319.20
5.4.400.0070.03719.20
5.4.390.0070.03719.17
5.4.380.0100.04018.94
5.4.370.0100.03019.22
5.4.360.0070.04718.89
5.4.350.0030.04018.89
5.4.340.0070.06718.86
5.4.320.0030.08019.00
5.4.310.0100.07319.17
5.4.300.0170.07019.02
5.4.290.0170.06319.09
5.4.280.0130.07018.89
5.4.270.0100.04719.26
5.4.260.0070.04319.09
5.4.250.0100.04319.23
5.4.240.0130.07019.25
5.4.230.0100.04018.96
5.4.220.0070.07718.86
5.4.210.0130.06719.21
5.4.200.0030.05019.09
5.4.190.0030.05019.18
5.4.180.0000.04318.86
5.4.170.0170.06719.16
5.4.160.0100.06318.85
5.4.150.0070.05019.08
5.4.140.0100.07016.40
5.4.130.0030.03716.48
5.4.120.0030.07316.61
5.4.110.0100.05716.54
5.4.100.0100.07016.37
5.4.90.0030.06716.50
5.4.80.0030.03716.59
5.4.70.0000.07716.54
5.4.60.0000.07716.46
5.4.50.0070.03716.38
5.4.40.0030.05716.45
5.4.30.0000.04016.47
5.4.20.0130.07016.51
5.4.10.0100.03316.49
5.4.00.0000.04016.02
5.3.290.0100.04314.73
5.3.280.0130.07314.66
5.3.270.0130.05014.73
5.3.260.0030.07714.69
5.3.250.0170.05314.66
5.3.240.0030.04314.71
5.3.230.0030.04714.58
5.3.220.0100.06314.62
5.3.210.0030.05014.70
5.3.200.0130.03014.78
5.3.190.0100.04714.69
5.3.180.0000.04314.65
5.3.170.0000.04014.70
5.3.160.0030.04014.70
5.3.150.0000.07714.63
5.3.140.0070.07314.61
5.3.130.0130.05014.61
5.3.120.0100.07714.63
5.3.110.0100.07714.66
5.3.100.0100.04314.18
5.3.90.0100.04714.22
5.3.80.0000.06714.13
5.3.70.0100.03713.98
5.3.60.0070.04314.06
5.3.50.0030.04314.02
5.3.40.0170.03014.02
5.3.30.0070.06313.93
5.3.20.0130.07013.72
5.3.10.0070.07013.75
5.3.00.0030.05013.75
5.2.170.0100.02311.23
5.2.160.0000.04011.08
5.2.150.0030.03010.99
5.2.140.0070.02711.11
5.2.130.0030.04711.26
5.2.120.0100.03010.96
5.2.110.0030.05711.04
5.2.100.0030.03010.96
5.2.90.0000.06010.96
5.2.80.0030.05711.18
5.2.70.0070.04310.95
5.2.60.0000.05011.14
5.2.50.0030.03010.92
5.2.40.0070.04010.98
5.2.30.0070.06310.90
5.2.20.0100.05710.94
5.2.10.0070.04310.91
5.2.00.0070.06010.80
5.1.60.0030.0409.97
5.1.50.0030.0579.95
5.1.40.0070.0509.95
5.1.30.0070.05310.37
5.1.20.0000.05010.21
5.1.10.0070.0379.91
5.1.00.0000.06010.09
5.0.50.0100.0208.68
5.0.40.0030.0408.68
5.0.30.0030.0538.68
5.0.20.0030.0208.68
5.0.10.0070.0178.68
5.0.00.0030.0638.68
4.4.90.0030.0338.68
4.4.80.0030.0178.68
4.4.70.0100.0308.68
4.4.60.0070.0278.68
4.4.50.0030.0378.68
4.4.40.0000.0478.68
4.4.30.0030.0208.68
4.4.20.0000.0208.68
4.4.10.0000.0238.68
4.4.00.0030.0538.68
4.3.110.0100.0308.68
4.3.100.0000.0308.68
4.3.90.0000.0178.68
4.3.80.0030.0278.68
4.3.70.0000.0378.68
4.3.60.0000.0278.68
4.3.50.0000.0238.68
4.3.40.0000.0308.68
4.3.30.0000.0408.68
4.3.20.0000.0278.68
4.3.10.0000.0378.68
4.3.00.0000.0378.68

preferences:
140.06 ms | 1386 KiB | 7 Q