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($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' ))); 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.3.10.0160.00316.95
7.3.00.0100.00716.93
7.2.130.0080.00817.00
7.2.120.0120.00617.11
7.2.110.0130.01017.14
7.2.100.0130.00917.15
7.2.90.0090.00817.07
7.2.80.0100.01617.24
7.2.70.0130.00616.94
7.2.60.0190.00817.13
7.2.50.0040.01217.04
7.2.40.0000.01917.34
7.2.30.0030.01216.83
7.2.20.0090.00617.25
7.2.10.0110.00417.25
7.2.00.0060.01217.16
7.1.250.0040.01216.18
7.1.70.0030.00617.41
7.1.60.0070.02019.24
7.1.50.0040.01817.16
7.1.00.0030.08022.45
7.0.200.0090.00916.93
7.0.140.0030.07322.00
7.0.100.0100.06720.04
7.0.90.0070.08319.97
7.0.80.0100.08320.05
7.0.70.0100.07719.96
7.0.60.0030.08720.13
7.0.50.0070.05320.23
7.0.40.0070.08320.00
7.0.30.0030.08320.04
7.0.20.0200.07320.06
7.0.10.0170.07720.04
7.0.00.0100.06320.10
5.6.280.0030.07721.11
5.6.250.0130.07720.90
5.6.240.0000.09020.59
5.6.230.0130.08020.59
5.6.220.0100.07320.77
5.6.210.0100.07720.77
5.6.200.0100.08721.14
5.6.190.0170.07021.26
5.6.180.0130.03721.05
5.6.170.0170.04321.20
5.6.160.0130.07721.21
5.6.150.0100.08721.09
5.6.140.0100.07321.20
5.6.130.0100.07721.14
5.6.120.0070.06321.10
5.6.110.0170.04721.18
5.6.100.0130.07721.14
5.6.90.0100.05321.14
5.6.80.0130.07020.55
5.6.70.0070.08020.64
5.6.60.0000.09020.48
5.6.50.0030.08720.52
5.6.40.0100.06020.49
5.6.30.0030.08020.57
5.6.20.0030.08020.54
5.6.10.0000.05720.47
5.6.00.0100.06720.46
5.5.380.0100.06320.49
5.5.370.0030.09320.43
5.5.360.0200.06320.50
5.5.350.0000.09020.54
5.5.340.0030.08721.02
5.5.330.0100.08320.82
5.5.320.0130.03320.97
5.5.310.0070.07320.88
5.5.300.0230.06320.84
5.5.290.0130.06721.01
5.5.280.0130.07720.73
5.5.270.0070.08320.92
5.5.260.0030.08720.95
5.5.250.0030.08720.54
5.5.240.0130.07020.38
5.5.230.0100.07320.40
5.5.220.0030.08020.36
5.5.210.0170.07720.40
5.5.200.0200.07320.37
5.5.190.0130.07320.21
5.5.180.0100.07020.22
5.5.160.0130.07720.21
5.5.150.0070.07720.20
5.5.140.0070.07720.29
5.5.130.0130.07020.08
5.5.120.0170.07020.34
5.5.110.0130.05720.20
5.5.100.0130.07720.14
5.5.90.0170.07020.21
5.5.80.0070.07720.15
5.5.70.0070.05720.14
5.5.60.0100.04320.12
5.5.50.0200.06720.24
5.5.40.0130.07720.14
5.5.30.0100.07320.20
5.5.20.0070.08020.23
5.5.10.0070.08020.21
5.5.00.0030.08720.06
5.4.450.0030.07719.42
5.4.440.0070.08319.27
5.4.430.0070.08319.58
5.4.420.0070.08319.30
5.4.410.0100.07719.11
5.4.400.0030.05018.99
5.4.390.0130.07319.16
5.4.380.0130.07719.08
5.4.370.0030.08318.91
5.4.360.0030.07719.07
5.4.350.0070.05018.91
5.4.340.0070.07319.11
5.4.320.0100.06719.06
5.4.310.0130.07319.18
5.4.300.0100.07318.91
5.4.290.0170.06719.13
5.4.280.0170.03718.91
5.4.270.0130.04719.04
5.4.260.0030.08019.21
5.4.250.0130.07318.98
5.4.240.0070.06019.24
5.4.230.0030.06019.12
5.4.220.0000.06319.23
5.4.210.0100.07719.19
5.4.200.0100.07318.90
5.4.190.0200.03719.15
5.4.180.0030.05019.21
5.4.170.0070.06319.17
5.4.160.0000.04319.07
5.4.150.0100.05019.07
5.4.140.0070.07016.55
5.4.130.0170.04716.54
5.4.120.0100.06716.48
5.4.110.0070.04716.56
5.4.100.0030.08016.60
5.4.90.0030.06016.46
5.4.80.0000.07316.56
5.4.70.0170.06316.40
5.4.60.0030.07316.48
5.4.50.0100.05716.39
5.4.40.0130.06716.54
5.4.30.0100.06316.47
5.4.20.0070.06016.40
5.4.10.0130.06716.50
5.4.00.0070.06715.87
5.3.290.0070.07714.77
5.3.280.0030.08714.68
5.3.270.0030.04314.80
5.3.260.0070.07714.71
5.3.250.0130.07014.81
5.3.240.0130.05714.64
5.3.230.0070.06314.71
5.3.220.0070.07714.73
5.3.210.0100.04014.68
5.3.200.0030.06014.73
5.3.190.0170.06314.70
5.3.180.0130.07014.68
5.3.170.0070.07714.82
5.3.160.0070.07014.71
5.3.150.0100.07014.81
5.3.140.0070.05714.85
5.3.130.0030.07314.84
5.3.120.0030.08314.62
5.3.110.0100.07014.76
5.3.100.0000.08314.15
5.3.90.0170.06714.17
5.3.80.0130.03714.22
5.3.70.0070.06714.27
5.3.60.0170.05714.14
5.3.50.0070.03314.13
5.3.40.0130.06714.10
5.3.30.0070.07713.98
5.3.20.0000.08013.82
5.3.10.0170.06313.73
5.3.00.0100.07313.95
5.2.170.0100.05311.76
5.2.160.0030.06011.76
5.2.150.0030.06711.76
5.2.140.0070.05711.76
5.2.130.0130.05011.76
5.2.120.0070.06011.76
5.2.110.0100.05311.76
5.2.100.0070.05711.76
5.2.90.0100.05711.76
5.2.80.0200.05011.76
5.2.70.0030.06011.76
5.2.60.0000.03711.76
5.2.50.0170.04711.76
5.2.40.0100.03311.76
5.2.30.0070.07011.76
5.2.20.0070.05711.76
5.2.10.0030.05011.76
5.2.00.0030.06311.76
5.1.60.0070.05011.76
5.1.50.0100.04711.76
5.1.40.0100.04711.76
5.1.30.0130.05011.76
5.1.20.0000.05711.76
5.1.10.0100.03711.76
5.1.00.0070.05711.76
5.0.50.0000.04711.76
5.0.40.0030.04311.76
5.0.30.0000.06011.76
5.0.20.0070.04011.76
5.0.10.0000.02711.76
5.0.00.0030.06711.76
4.4.90.0000.03711.76
4.4.80.0030.03311.76
4.4.70.0070.03011.76
4.4.60.0070.03311.76
4.4.50.0000.02711.76
4.4.40.0070.05011.76
4.4.30.0130.02711.76
4.4.20.0070.03311.76
4.4.10.0000.02711.76
4.4.00.0030.05311.76
4.3.110.0030.01711.76
4.3.100.0030.03011.76
4.3.90.0000.02011.76
4.3.80.0030.05011.76
4.3.70.0070.01311.76
4.3.60.0070.03011.76
4.3.50.0030.03311.76
4.3.40.0030.05011.76
4.3.30.0000.03711.76
4.3.20.0000.03711.76
4.3.10.0070.03011.76
4.3.00.0000.03311.76

preferences:
40.36 ms | 400 KiB | 5 Q