3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Set demo vars $year = 2012; $months = array(10,11,12); $days = array(1,2,3,4,6,7,8,9,11,12,13,14,16,17,18,19,21,22,23,24,26,27,28,30); $dateWs = array(); foreach($months AS $month) foreach($days AS $day) $datesWS[] = new DateTime(implode('-',array($year,$month,$day))); // Push DateTime object to the WebService array // Shuffle shuffle($datesWS); // 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->modify( '+1 day' ))); // This way seems to work $excludeDates = array(); 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'); } var_dump($datesRange); /* // 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)
7.3.10.0340.00616.57
7.3.00.0250.01816.14
7.2.130.0210.02116.98
7.2.120.0150.01916.78
7.2.110.0200.01716.34
7.2.100.0130.02217.02
7.2.90.0260.01016.96
7.2.80.0100.03116.78
7.2.70.0160.01316.77
7.2.60.0220.01316.81
7.2.50.0160.02016.51
7.2.40.0140.02116.80
7.2.30.0160.01917.06
7.2.20.0190.01916.78
7.2.10.0200.01316.87
7.2.00.0100.01818.02
7.1.250.0190.01916.04
7.1.70.0030.01017.33
7.1.60.0070.02519.40
7.1.50.0170.01716.95
7.1.00.0030.03722.45
7.0.200.0030.01016.80
7.0.140.0130.07321.95
7.0.120.0030.07022.09
7.0.110.0170.08320.17
7.0.100.0230.08020.07
7.0.90.0230.08320.02
7.0.80.0200.07720.06
7.0.70.0070.08720.04
7.0.60.0130.07720.45
7.0.50.0270.08020.28
7.0.40.0070.09020.02
7.0.30.0130.07319.97
7.0.20.0030.05719.98
7.0.10.0100.08720.02
7.0.00.0070.07720.14
5.6.280.0100.08021.23
5.6.260.0100.05320.72
5.6.250.0170.08720.78
5.6.240.0100.07720.66
5.6.230.0100.09720.63
5.6.220.0070.08720.75
5.6.210.0100.09020.64
5.6.200.0070.09320.62
5.6.190.0130.07720.71
5.6.180.0130.04720.55
5.6.170.0030.09720.64
5.6.160.0170.07320.78
5.6.150.0130.09320.73
5.6.140.0170.09020.76
5.6.130.0030.04720.70
5.6.120.0070.09720.71
5.6.110.0070.09320.70
5.6.100.0170.08320.72
5.6.90.0130.08720.92
5.6.80.0170.08320.18
5.6.70.0130.08020.02
5.6.60.0070.09020.08
5.6.50.0070.07720.16
5.6.40.0130.08020.06
5.6.30.0230.07320.02
5.6.20.0000.09720.06
5.6.10.0100.08020.15
5.6.00.0200.04720.08
5.5.380.0130.07720.62
5.5.370.0100.05020.63
5.5.360.0170.08020.55
5.5.350.0100.06320.59
5.5.340.0100.08720.93
5.5.330.0200.08320.99
5.5.320.0070.09020.87
5.5.310.0100.08020.99
5.5.300.0170.08020.81
5.5.290.0070.09721.04
5.5.280.0100.08721.10
5.5.270.0100.08321.10
5.5.260.0000.09020.89
5.5.250.0070.05020.85
5.5.240.0070.08320.15
5.5.230.0000.09720.45
5.5.220.0000.05320.27
5.5.210.0230.06720.41
5.5.200.0000.08020.43
5.5.190.0130.08720.38
5.5.180.0100.07720.39
5.5.160.0170.07320.32
5.5.150.0030.05720.14
5.5.140.0100.06320.32
5.5.130.0070.07020.25
5.5.120.0100.09020.22
5.5.110.0100.08320.24
5.5.100.0030.07020.14
5.5.90.0030.09320.18
5.5.80.0130.09020.10
5.5.70.0100.08720.27
5.5.60.0100.06320.35
5.5.50.0100.08320.32
5.5.40.0170.08020.15
5.5.30.0130.07320.30
5.5.20.0130.08320.26
5.5.10.0170.08020.32
5.5.00.0130.08020.01
5.4.450.0000.06019.39
5.4.440.0030.08319.70
5.4.430.0170.07719.36
5.4.420.0100.08719.55
5.4.410.0130.08019.33
5.4.400.0070.07319.23
5.4.390.0170.07719.35
5.4.380.0070.08318.99
5.4.370.0070.09319.21
5.4.360.0130.08019.22
5.4.350.0130.08019.06
5.4.340.0100.08319.14
5.4.320.0070.04319.23
5.4.310.0030.08719.22
5.4.300.0100.07719.03
5.4.290.0130.08019.21
5.4.280.0070.08719.35
5.4.270.0100.07719.35
5.4.260.0170.07719.05
5.4.250.0100.08019.21
5.4.240.0130.07719.05
5.4.230.0200.07319.02
5.4.220.0100.06319.07
5.4.210.0230.07319.21
5.4.200.0100.06719.13
5.4.190.0000.08319.01
5.4.180.0130.07019.31
5.4.170.0130.08319.04
5.4.160.0170.07719.36
5.4.150.0100.07319.07
5.4.140.0070.08016.39
5.4.130.0100.04316.55
5.4.120.0070.07716.55
5.4.110.0130.07316.50
5.4.100.0070.08316.56
5.4.90.0100.07016.68
5.4.80.0070.07316.58
5.4.70.0130.07716.63
5.4.60.0130.08016.49
5.4.50.0130.07016.62
5.4.40.0070.08016.53
5.4.30.0070.04716.56
5.4.20.0100.06316.54
5.4.10.0130.08016.48
5.4.00.0100.07716.02
5.3.290.0170.06015.09
5.3.280.0070.07714.81
5.3.270.0130.08014.94
5.3.260.0130.08014.77
5.3.250.0100.06314.80
5.3.240.0130.08014.79
5.3.230.0100.07714.82
5.3.220.0200.08014.76
5.3.210.0030.08714.63
5.3.200.0070.06014.90
5.3.190.0170.07314.79
5.3.180.0070.05314.91
5.3.170.0000.06014.80
5.3.160.0230.07714.86
5.3.150.0100.05714.77
5.3.140.0030.05314.90
5.3.130.0070.08014.73
5.3.120.0100.07714.73
5.3.110.0170.06014.98
5.3.100.0070.09314.37
5.3.90.0030.06314.08
5.3.80.0070.07314.21
5.3.70.0130.07714.27
5.3.60.0170.07014.21
5.3.50.0000.08014.23
5.3.40.0130.08014.27
5.3.30.0100.08014.08
5.3.20.0070.07013.90
5.3.10.0130.06713.87
5.3.00.0100.08013.95
5.2.170.0030.03713.07
5.2.160.0000.06313.07
5.2.150.0070.05313.07
5.2.140.0070.05313.07
5.2.130.0130.05013.07
5.2.120.0030.06313.07
5.2.110.0000.06313.07
5.2.100.0000.06713.07
5.2.90.0030.06313.07
5.2.80.0130.05313.07
5.2.70.0100.03013.07
5.2.60.0100.05313.07
5.2.50.0000.05313.07
5.2.40.0030.06013.07
5.2.30.0070.05713.07
5.2.20.0100.03713.07
5.2.10.0070.05713.07
5.2.00.0070.03313.07
5.1.60.0030.05713.07
5.1.50.0070.03013.07
5.1.40.0070.05013.07
5.1.30.0030.05013.07
5.1.20.0000.03313.07
5.1.10.0000.06313.07
5.1.00.0070.02713.07
5.0.50.0030.02013.07
5.0.40.0030.01713.07
5.0.30.0030.04313.07
5.0.20.0000.02013.07
5.0.10.0000.02013.07
5.0.00.0030.02713.07
4.4.90.0070.03013.07
4.4.80.0070.02313.07
4.4.70.0070.03013.07
4.4.60.0030.03713.07
4.4.50.0030.03313.07
4.4.40.0030.03713.07
4.4.30.0030.02713.07
4.4.20.0000.01713.07
4.4.10.0000.03313.07
4.4.00.0000.02713.07
4.3.110.0100.02713.07
4.3.100.0000.01713.07
4.3.90.0000.01713.07
4.3.80.0030.02013.07
4.3.70.0000.01713.07
4.3.60.0000.01713.07
4.3.50.0000.01713.07
4.3.40.0000.02313.07
4.3.30.0000.01713.07
4.3.20.0030.01313.07
4.3.10.0000.01313.07
4.3.00.0030.01013.07

preferences:
37.96 ms | 401 KiB | 5 Q