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,29); $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($excludeDates); /* // 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.120.0030.01314.96
7.3.110.0060.01215.34
7.3.100.0070.01415.18
7.3.90.0000.01815.19
7.3.80.0030.01315.11
7.3.70.0000.01815.03
7.3.60.0120.00915.25
7.3.50.0090.00914.91
7.3.40.0060.01315.08
7.3.30.0000.02614.99
7.3.20.0110.01117.10
7.3.10.0060.01516.84
7.3.00.0110.01016.75
7.2.240.0060.01015.12
7.2.230.0130.00915.36
7.2.220.0070.01415.33
7.2.210.0040.01515.55
7.2.200.0070.01415.30
7.2.190.0070.01115.30
7.2.180.0000.02115.40
7.2.170.0030.01615.50
7.2.160.0090.02115.36
7.2.150.0120.00917.02
7.2.140.0130.00717.22
7.2.130.0070.01817.06
7.2.120.0080.01517.13
7.2.110.0090.01616.96
7.2.100.0020.02117.13
7.2.90.0140.01517.14
7.2.80.0060.01517.34
7.2.70.0110.01717.19
7.2.60.0070.02017.15
7.2.50.0070.01917.23
7.2.40.0080.01817.10
7.2.30.0090.01817.16
7.2.20.0080.01817.08
7.2.10.0100.01217.15
7.2.00.0110.01017.25
7.1.330.0060.01215.98
7.1.320.0110.01116.18
7.1.310.0000.01616.06
7.1.300.0100.01016.18
7.1.290.0030.01716.16
7.1.280.0060.00916.14
7.1.270.0090.01616.08
7.1.260.0060.01315.97
7.1.250.0070.01415.94
7.1.70.0090.00317.55
7.1.60.0040.01117.42
7.1.50.0090.02117.18
7.1.00.0030.07722.48
7.0.200.0000.01016.88
7.0.140.0100.07321.90
7.0.90.0130.06320.05
7.0.80.0030.05319.91
7.0.70.0100.10320.09
7.0.60.0000.08320.33
7.0.50.0200.06720.65
7.0.40.0100.08020.45
7.0.30.0030.05020.45
7.0.20.0100.08320.32
7.0.10.0030.09020.36
7.0.00.0100.08320.36
5.6.280.0030.08021.11
5.6.230.0070.09020.76
5.6.220.0100.08320.70
5.6.210.0170.08020.74
5.6.200.0070.09721.09
5.6.190.0100.09321.14
5.6.180.0100.09321.19
5.6.170.0030.09721.03
5.6.160.0100.10321.15
5.6.150.0200.09021.03
5.6.140.0100.09321.15
5.6.130.0130.09021.08
5.6.120.0070.09321.09
5.6.110.0070.10021.13
5.6.100.0100.09021.10
5.6.90.0030.05721.00
5.6.80.0100.08720.49
5.6.70.0070.09720.51
5.6.60.0130.08020.61
5.6.50.0030.06020.58
5.6.40.0100.07720.47
5.6.30.0000.06720.46
5.6.20.0100.07020.52
5.6.10.0230.07320.46
5.6.00.0170.07720.51
5.5.370.0030.04720.44
5.5.360.0300.07020.43
5.5.350.0100.10020.42
5.5.340.0130.06020.96
5.5.330.0230.08320.84
5.5.320.0100.09720.98
5.5.310.0170.07720.88
5.5.300.0130.09320.72
5.5.290.0170.05720.96
5.5.280.0100.07320.93
5.5.270.0100.09020.91
5.5.260.0200.07720.89
5.5.250.0130.09020.68
5.5.240.0070.09020.33
5.5.230.0100.08720.09
5.5.220.0130.08720.38
5.5.210.0170.07020.25
5.5.200.0030.06720.07
5.5.190.0170.09020.25
5.5.180.0130.07320.28
5.5.160.0100.07020.29
5.5.150.0070.06720.27
5.5.140.0070.08020.28
5.5.130.0130.08320.34
5.5.120.0070.08720.17
5.5.110.0100.06020.14
5.5.100.0070.04320.23
5.5.90.0130.07720.19
5.5.80.0130.05320.08
5.5.70.0070.07320.18
5.5.60.0100.08320.01
5.5.50.0100.08320.18
5.5.40.0070.06720.24
5.5.30.0130.07720.22
5.5.20.0170.07720.12
5.5.10.0030.08320.12
5.5.00.0230.08720.11
5.4.450.0170.06319.58
5.4.440.0030.09319.55
5.4.430.0100.07319.46
5.4.420.0070.08319.30
5.4.410.0070.08019.24
5.4.400.0130.08019.21
5.4.390.0100.08319.05
5.4.380.0070.05318.93
5.4.370.0070.08318.91
5.4.360.0070.09019.12
5.4.350.0100.07719.11
5.4.340.0170.07718.92
5.4.320.0070.08319.24
5.4.310.0070.07719.23
5.4.300.0070.04718.89
5.4.290.0130.07319.14
5.4.280.0130.05018.89
5.4.270.0070.08319.18
5.4.260.0070.04319.14
5.4.250.0070.08319.13
5.4.240.0070.08319.23
5.4.230.0100.05319.23
5.4.220.0070.08319.17
5.4.210.0070.04718.91
5.4.200.0170.07719.23
5.4.190.0070.05719.04
5.4.180.0070.08319.18
5.4.170.0030.09318.97
5.4.160.0100.08019.22
5.4.150.0030.09318.92
5.4.140.0100.08016.57
5.4.130.0030.07716.40
5.4.120.0130.03716.52
5.4.110.0070.08016.52
5.4.100.0130.07716.50
5.4.90.0100.06716.57
5.4.80.0070.04716.45
5.4.70.0030.04716.52
5.4.60.0030.08716.45
5.4.50.0070.05316.52
5.4.40.0100.08016.41
5.4.30.0070.06716.48
5.4.20.0100.07716.52
5.4.10.0100.06316.48
5.4.00.0070.04315.95
5.3.290.0000.07014.80
5.3.280.0030.09014.73
5.3.270.0130.08314.78
5.3.260.0100.07314.84
5.3.250.0070.06714.81
5.3.240.0070.05314.76
5.3.230.0070.04714.75
5.3.220.0070.04714.74
5.3.210.0030.07314.83
5.3.200.0030.09014.66
5.3.190.0030.08014.77
5.3.180.0070.08314.70
5.3.170.0030.08314.77
5.3.160.0030.08314.74
5.3.150.0130.04714.82
5.3.140.0070.08014.79
5.3.130.0070.05014.67
5.3.120.0170.04714.75
5.3.110.0130.07714.75
5.3.100.0030.09014.25
5.3.90.0030.07314.23
5.3.80.0100.04714.22
5.3.70.0070.05714.07
5.3.60.0170.06014.29
5.3.50.0070.05014.13
5.3.40.0030.06314.01
5.3.30.0030.08714.03
5.3.20.0070.06713.83
5.3.10.0070.07713.71
5.3.00.0070.08713.94
5.2.170.0100.06013.62
5.2.160.0070.06013.62
5.2.150.0070.06013.62
5.2.140.0070.03713.62
5.2.130.0070.06013.62
5.2.120.0100.06013.62
5.2.110.0100.06013.62
5.2.100.0030.04713.62
5.2.90.0070.05713.62
5.2.80.0030.05013.62
5.2.70.0000.03313.62
5.2.60.0070.05713.62
5.2.50.0130.04713.62
5.2.40.0070.05713.62
5.2.30.0070.05713.62
5.2.20.0030.06313.62
5.2.10.0100.05713.62
5.2.00.0100.05013.62
5.1.60.0030.05313.62
5.1.50.0000.03313.62
5.1.40.0030.05713.62
5.1.30.0130.03313.62
5.1.20.0030.06013.62
5.1.10.0100.04713.62
5.1.00.0030.05313.62
5.0.50.0000.02313.62
5.0.40.0170.03013.62
5.0.30.0030.04313.62
5.0.20.0000.04313.62
5.0.10.0030.02013.62
5.0.00.0030.02713.62
4.4.90.0030.03313.62
4.4.80.0030.03313.62
4.4.70.0000.04013.62
4.4.60.0030.02313.62
4.4.50.0000.03713.62
4.4.40.0030.04013.62
4.4.30.0070.02713.62
4.4.20.0100.02713.62
4.4.10.0030.03313.62
4.4.00.0030.02313.62
4.3.110.0000.01713.62
4.3.100.0000.02713.62
4.3.90.0000.01713.62
4.3.80.0000.02713.62
4.3.70.0030.03313.62
4.3.60.0000.03013.62
4.3.50.0070.03313.62
4.3.40.0070.04713.62
4.3.30.0030.01713.62
4.3.20.0030.03313.62
4.3.10.0030.03013.62
4.3.00.0000.02013.62

preferences:
35.91 ms | 401 KiB | 5 Q