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','30'); $dateWs = array(); foreach($months AS $month) foreach($days AS $day) $datesWS[] = new DateTime(implode('-',array(intval($year),intval($month),intval($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' ))); var_dump(array_values(array_map(function($obj){ return $obj->format('d/m/Y'); },$datesWS))); die(); // 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'); } 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.4.00.0100.01014.96
7.3.120.0120.00615.26
7.3.110.0120.00615.40
7.3.100.0070.00715.37
7.3.90.0110.00014.81
7.3.80.0110.00715.26
7.3.70.0040.00815.08
7.3.60.0070.00415.18
7.3.50.0040.01215.13
7.3.40.0060.00615.19
7.3.30.0070.00715.20
7.3.20.0120.00316.75
7.3.10.0130.00716.78
7.3.00.0080.00516.76
7.2.250.0100.01015.68
7.2.240.0040.01815.59
7.2.230.0070.00715.31
7.2.220.0060.00615.47
7.2.210.0070.01015.42
7.2.200.0030.00915.39
7.2.190.0100.00315.07
7.2.180.0120.00415.32
7.2.170.0090.00415.29
7.2.130.0100.00716.70
7.2.120.0110.00716.84
7.2.110.0160.00716.91
7.2.100.0050.01216.44
7.2.90.0300.00316.85
7.2.80.0230.00716.98
7.2.70.0210.00616.82
7.2.60.0020.01616.84
7.2.50.0150.00417.03
7.2.40.0070.01016.98
7.2.30.0060.01316.87
7.2.20.0040.01517.03
7.2.10.0170.00316.78
7.2.00.0060.00917.00
7.1.330.0110.00316.13
7.1.320.0080.00416.12
7.1.310.0080.00616.04
7.1.300.0060.00916.10
7.1.290.0000.01616.10
7.1.280.0000.01016.13
7.1.270.0040.01115.77
7.1.260.0090.00615.84
7.1.250.0080.00615.81
7.1.70.0000.00817.28
7.1.60.0030.01719.82
7.1.50.0090.01317.24
7.1.00.0000.08022.36
7.0.200.0060.00317.01
7.0.140.0070.07322.17
7.0.100.0100.05319.96
7.0.90.0030.05019.93
7.0.80.0070.04719.92
7.0.70.0270.04719.96
7.0.60.0270.04320.41
7.0.50.0100.06020.61
7.0.40.0070.05720.29
7.0.30.0100.06320.43
7.0.20.0030.06720.33
7.0.10.0130.06320.46
7.0.00.0130.05320.36
5.6.280.0130.06721.00
5.6.250.0270.04020.68
5.6.240.0030.09020.60
5.6.230.0070.04320.72
5.6.220.0070.07020.73
5.6.210.0030.08720.70
5.6.200.0170.07721.15
5.6.190.0030.05721.27
5.6.180.0100.08021.17
5.6.170.0000.07021.01
5.6.160.0130.04021.18
5.6.150.0030.07721.05
5.6.140.0030.06021.11
5.6.130.0030.06321.03
5.6.120.0170.07321.04
5.6.110.0100.06021.12
5.6.100.0170.04321.04
5.6.90.0100.05021.18
5.6.80.0000.07020.41
5.6.70.0070.04020.53
5.6.60.0000.07020.59
5.6.50.0000.05720.59
5.6.40.0000.04720.48
5.6.30.0070.04320.47
5.6.20.0130.05020.39
5.6.10.0070.04720.38
5.6.00.0030.04720.54
5.5.380.0170.05320.60
5.5.370.0030.04320.54
5.5.360.0030.06020.57
5.5.350.0170.06320.47
5.5.340.0130.06320.91
5.5.330.0130.04320.98
5.5.320.0030.08020.84
5.5.310.0030.05021.01
5.5.300.0170.05720.86
5.5.290.0030.07021.01
5.5.280.0130.06720.84
5.5.270.0070.06720.82
5.5.260.0070.06020.97
5.5.250.0000.05720.77
5.5.240.0130.06020.39
5.5.230.0130.07020.38
5.5.220.0070.06720.36
5.5.210.0070.06020.20
5.5.200.0130.04320.37
5.5.190.0000.05720.33
5.5.180.0070.04320.20
5.5.160.0100.04320.18
5.5.150.0070.04020.32
5.5.140.0100.05320.31
5.5.130.0100.04020.34
5.5.120.0070.04320.32
5.5.110.0130.04020.35
5.5.100.0000.06020.04
5.5.90.0000.04720.16
5.5.80.0100.04720.18
5.5.70.0100.05020.11
5.5.60.0070.06320.15
5.5.50.0070.04320.18
5.5.40.0130.05320.22
5.5.30.0100.05020.22
5.5.20.0070.04020.14
5.5.10.0000.06320.09
5.5.00.0030.05320.04
5.4.450.0000.06319.41
5.4.440.0200.05019.24
5.4.430.0170.06719.23
5.4.420.0070.04319.40
5.4.410.0000.05019.39
5.4.400.0130.04319.09
5.4.390.0030.05018.89
5.4.380.0100.04719.25
5.4.370.0130.04319.21
5.4.360.0030.04319.09
5.4.350.0100.05719.16
5.4.340.0030.04319.22
5.4.320.0030.05018.91
5.4.310.0100.04018.94
5.4.300.0130.05719.21
5.4.290.0070.03719.19
5.4.280.0100.04318.94
5.4.270.0070.04719.06
5.4.260.0100.04318.91
5.4.250.0030.04319.16
5.4.240.0030.05319.17
5.4.230.0030.05319.06
5.4.220.0030.05019.26
5.4.210.0070.04719.06
5.4.200.0100.05719.27
5.4.190.0000.04719.04
5.4.180.0000.07318.90
5.4.170.0000.04318.97
5.4.160.0100.04719.07
5.4.150.0030.05019.18
5.4.140.0030.05016.50
5.4.130.0070.05316.50
5.4.120.0030.04716.53
5.4.110.0130.05016.60
5.4.100.0030.05016.36
5.4.90.0200.04016.60
5.4.80.0100.06716.58
5.4.70.0000.05016.51
5.4.60.0000.04716.39
5.4.50.0030.04016.56
5.4.40.0070.03316.34
5.4.30.0100.04316.40
5.4.20.0070.04316.57
5.4.10.0070.05016.45
5.4.00.0030.04015.95
5.3.290.0030.05014.92
5.3.280.0000.06014.69
5.3.270.0070.04314.69
5.3.260.0100.07014.82
5.3.250.0030.04714.68
5.3.240.0070.05314.85
5.3.230.0100.04014.81
5.3.220.0030.07314.78
5.3.210.0100.06314.70
5.3.200.0100.05714.72
5.3.190.0130.06014.75
5.3.180.0030.04714.72
5.3.170.0030.05714.74
5.3.160.0170.05314.64
5.3.150.0030.04314.77
5.3.140.0070.03714.83
5.3.130.0070.04714.67
5.3.120.0130.05014.76
5.3.110.0100.04314.81
5.3.100.0030.07314.18
5.3.90.0070.07314.10
5.3.80.0100.06014.15
5.3.70.0130.06714.06
5.3.60.0070.05014.25
5.3.50.0070.06014.23
5.3.40.0200.04714.09
5.3.30.0070.04014.19
5.3.20.0130.06313.78
5.3.10.0030.04713.78
5.3.00.0070.04313.79
5.2.170.0000.05011.00
5.2.160.0030.03711.00
5.2.150.0100.04711.20
5.2.140.0030.03011.19
5.2.130.0070.04311.10
5.2.120.0030.04711.16
5.2.110.0000.04710.90
5.2.100.0100.03711.09
5.2.90.0000.05311.06
5.2.80.0100.05711.14
5.2.70.0000.04310.93
5.2.60.0030.05311.13
5.2.50.0000.06010.89
5.2.40.0070.03710.99
5.2.30.0030.04310.98
5.2.20.0070.03010.76
5.2.10.0170.04710.93
5.2.00.0100.06010.66
5.1.60.0070.03010.50
5.1.50.0030.02710.50
5.1.40.0000.05010.50
5.1.30.0070.05710.50
5.1.20.0030.06010.50
5.1.10.0000.04010.50
5.1.00.0070.04310.50
5.0.50.0100.04010.50
5.0.40.0030.04310.50
5.0.30.0030.05310.50
5.0.20.0070.03310.50
5.0.10.0000.03010.50
5.0.00.0100.05710.50
4.4.90.0030.03310.50
4.4.80.0030.02710.50
4.4.70.0030.02310.50
4.4.60.0000.02310.50
4.4.50.0000.02310.50
4.4.40.0000.03010.50
4.4.30.0070.02310.50
4.4.20.0070.02710.50
4.4.10.0030.03310.50
4.4.00.0070.04010.50
4.3.110.0000.02710.50
4.3.100.0070.02710.50
4.3.90.0030.02710.50
4.3.80.0000.04710.50
4.3.70.0070.02710.50
4.3.60.0030.03010.50
4.3.50.0000.03010.50
4.3.40.0000.04710.50
4.3.30.0000.03010.50
4.3.20.0000.03710.50
4.3.10.0000.03010.50
4.3.00.0070.03010.50

preferences:
36.28 ms | 401 KiB | 5 Q