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 ? $datesWS[0] : 0; // Get first date $dateEnd = count($datesWS)>0 ? $datesWS[count($datesWS)-1] : 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($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.10.0100.01315.18
7.4.00.0100.01415.34
7.3.130.0070.01715.37
7.3.120.0090.01615.34
7.3.110.0130.00715.26
7.3.100.0130.01015.29
7.3.90.0170.00715.22
7.3.80.0110.00415.28
7.3.70.0030.01315.29
7.3.60.0040.01115.11
7.3.50.0030.01515.17
7.3.40.0030.01314.98
7.3.30.0090.00915.25
7.3.20.0030.01216.98
7.3.10.0070.00716.71
7.3.00.0140.00316.97
7.2.260.0160.00615.41
7.2.250.0120.01215.04
7.2.240.0060.01315.41
7.2.230.0100.01015.03
7.2.220.0130.00915.26
7.2.210.0070.01015.48
7.2.200.0090.01215.26
7.2.190.0040.01115.38
7.2.180.0060.00615.30
7.2.170.0120.00615.50
7.2.160.0030.01415.39
7.2.150.0100.00317.14
7.2.140.0100.00717.26
7.2.130.0110.00417.05
7.2.120.0070.00417.37
7.2.110.0140.00716.97
7.2.100.0060.01217.13
7.2.90.0120.00917.25
7.2.80.0140.00417.24
7.2.70.0000.01416.80
7.2.60.0030.01717.16
7.2.50.0070.00717.26
7.2.40.0130.00717.23
7.2.30.0070.00716.99
7.2.20.0080.00416.91
7.2.10.0080.00417.18
7.2.00.0090.00616.94
7.1.330.0070.01115.86
7.1.320.0070.01416.20
7.1.310.0150.00316.04
7.1.300.0160.00616.00
7.1.290.0070.01015.93
7.1.280.0100.01015.90
7.1.270.0060.01316.09
7.1.260.0070.01115.98
7.1.250.0030.01516.12
7.1.240.0130.00315.78
7.1.230.0130.00616.15
7.1.220.0040.00816.04
7.1.210.0150.00316.08
7.1.200.0060.00915.96
7.1.190.0060.00915.78
7.1.180.0040.01116.01
7.1.170.0070.00716.19
7.1.160.0070.01016.04
7.1.150.0100.00315.95
7.1.140.0090.00615.79
7.1.130.0070.01116.17
7.1.120.0060.01216.20
7.1.110.0040.01116.06
7.1.100.0000.01416.09
7.1.90.0150.00415.81
7.1.80.0070.01015.75
7.1.70.0070.00716.67
7.1.60.0140.01217.71
7.1.50.0130.00916.76
7.1.40.0060.01215.61
7.1.30.0110.01115.98
7.1.20.0030.01415.72
7.1.10.0080.01115.93
7.1.00.0070.04419.24
7.0.330.0090.00315.73
7.0.320.0110.00715.60
7.0.310.0140.00315.58
7.0.300.0030.01315.71
7.0.290.0100.01615.52
7.0.280.0070.01315.57
7.0.270.0120.00615.59
7.0.260.0130.01015.50
7.0.250.0040.00815.36
7.0.240.0140.00315.54
7.0.230.0000.01815.47
7.0.220.0060.01215.41
7.0.210.0000.01115.26
7.0.200.0090.00716.18
7.0.190.0090.00915.57
7.0.180.0100.00615.73
7.0.170.0030.01715.74
7.0.160.0070.01315.70
7.0.150.0090.00915.61
7.0.140.0080.04018.82
7.0.130.0100.00715.79
7.0.120.0080.00415.57
7.0.110.0100.00715.51
7.0.100.0080.02817.58
7.0.90.0140.04217.79
7.0.80.0210.03317.76
7.0.70.0200.04617.63
7.0.60.0260.04617.84
7.0.50.0090.03118.07
7.0.40.0090.04816.74
7.0.30.0090.04216.90
7.0.20.0160.04016.79
7.0.10.0110.04816.65
7.0.00.0130.05116.65
5.6.400.0090.00914.49
5.6.390.0210.00614.52
5.6.380.0150.00914.72
5.6.370.0070.00714.57
5.6.360.0090.00914.99
5.6.350.0150.00314.71
5.6.340.0070.01114.74
5.6.330.0090.00614.80
5.6.320.0110.00714.55
5.6.310.0040.01214.94
5.6.300.0070.01114.92
5.6.290.0120.01214.37
5.6.280.0080.04317.99
5.6.270.0090.00614.62
5.6.260.0100.00714.48
5.6.250.0100.04317.70
5.6.240.0080.03617.65
5.6.230.0100.04717.64
5.6.220.0050.04317.75
5.6.210.0080.04617.72
5.6.200.0090.04317.91
5.6.190.0150.04317.93
5.6.180.0080.04617.86
5.6.170.0050.04717.75
5.6.160.0120.03017.95
5.6.150.0080.04817.82
5.6.140.0110.04517.94
5.6.130.0100.04517.83
5.6.120.0060.04517.85
5.6.110.0070.05217.78
5.6.100.0170.03317.85
5.6.90.0070.04817.91
5.6.80.0140.03917.59
5.6.70.0050.04017.54
5.6.60.0050.03417.60
5.6.50.0080.02917.38
5.6.40.0080.04317.37
5.6.30.0150.04017.55
5.6.20.0110.02717.69
5.6.10.0070.04217.67
5.6.00.0050.02917.46
5.5.380.0150.04317.63
5.5.370.0100.04617.60
5.5.360.0080.03017.64
5.5.350.0130.04217.44
5.5.340.0080.03017.82
5.5.330.0140.04217.68
5.5.320.0110.04617.83
5.5.310.0080.04617.77
5.5.300.0050.04917.66
5.5.290.0140.02717.72
5.5.280.0110.04017.82
5.5.270.0130.04117.65
5.5.260.0080.05017.65
5.5.250.0030.03417.57
5.5.240.0070.04017.46
5.5.230.0050.04517.50
5.5.220.0080.03417.44
5.5.210.0150.03617.30
5.5.200.0050.02917.44
5.5.190.0070.03317.39
5.5.180.0060.04717.49
5.5.170.0030.01214.40
5.5.160.0150.04117.48
5.5.150.0100.03217.35
5.5.140.0080.04417.51
5.5.130.0100.02117.44
5.5.120.0120.04317.53
5.5.110.0070.03517.45
5.5.100.0110.02617.29
5.5.90.0050.03317.33
5.5.80.0140.03717.31
5.5.70.0100.04317.15
5.5.60.0080.04317.23
5.5.50.0070.03017.38
5.5.40.0070.03717.39
5.5.30.0070.03517.36
5.5.20.0120.03517.34
5.5.10.0050.02817.10
5.5.00.0070.04617.31
5.4.450.0020.04715.40
5.4.440.0050.02815.25
5.4.430.0110.04415.38
5.4.420.0160.03215.34
5.4.410.0050.02715.32
5.4.400.0070.04515.30
5.4.390.0080.04315.20
5.4.380.0110.04015.30
5.4.370.0070.03915.16
5.4.360.0070.03915.07
5.4.350.0090.04015.46
5.4.340.0070.04215.34
5.4.330.0030.01311.38
5.4.320.0080.04415.34
5.4.310.0070.04415.33
5.4.300.0100.04115.11
5.4.290.0090.02915.13
5.4.280.0080.04215.30
5.4.270.0130.03915.20
5.4.260.0050.02515.09
5.4.250.0140.03715.26
5.4.240.0130.03215.26
5.4.230.0040.04715.11
5.4.220.0130.03815.16
5.4.210.0050.04115.14
5.4.200.0130.04015.22
5.4.190.0100.04215.06
5.4.180.0070.04615.23
5.4.170.0100.03915.14
5.4.160.0170.04015.15
5.4.150.0180.02115.36
5.4.140.0120.03713.95
5.4.130.0060.04413.88
5.4.120.0090.02213.97
5.4.110.0080.02413.91
5.4.100.0120.01713.90
5.4.90.0070.04113.98
5.4.80.0090.04113.84
5.4.70.0180.01713.95
5.4.60.0050.02913.94
5.4.50.0080.03713.86
5.4.40.0100.04213.87
5.4.30.0120.04013.98
5.4.20.0040.03113.80
5.4.10.0050.02513.86
5.4.00.0080.01913.64
5.3.290.0070.02712.89
5.3.280.0140.03612.87
5.3.270.0110.04312.93
5.3.260.0130.03712.90
5.3.250.0070.05012.83
5.3.240.0050.04312.83
5.3.230.0160.03812.93
5.3.220.0140.03912.89
5.3.210.0070.02512.92
5.3.200.0080.02412.80
5.3.190.0140.04212.82
5.3.180.0110.03312.79
5.3.170.0110.03612.87
5.3.160.0080.03412.89
5.3.150.0100.03812.81
5.3.140.0140.03312.95
5.3.130.0100.03912.90
5.3.120.0100.02412.91
5.3.110.0110.02412.93
5.3.100.0070.02012.46
5.3.90.0070.02512.54
5.3.80.0160.01412.54
5.3.70.0040.02912.45
5.3.60.0090.02312.36
5.3.50.0140.01812.47
5.3.40.0040.02912.55
5.3.30.0110.02312.61
5.3.20.0020.02312.21
5.3.10.0030.02112.22
5.3.00.0030.02812.40
5.2.170.0000.03011.16
5.2.160.0030.02311.10
5.2.150.0000.03311.19
5.2.140.0030.03011.10
5.2.130.0000.02711.07
5.2.120.0000.03010.95
5.2.110.0030.02711.17
5.2.100.0000.03011.05
5.2.90.0030.02711.10
5.2.80.0070.02311.16
5.2.70.0030.02711.08
5.2.60.0000.03311.11
5.2.50.0070.03011.06
5.2.40.0030.02711.04
5.2.30.0000.03010.93
5.2.20.0070.05710.75
5.2.10.0000.02710.92
5.2.00.0000.06010.77
5.1.60.0030.03010.05
5.1.50.0000.04710.05
5.1.40.0000.0379.96
5.1.30.0000.02710.34
5.1.20.0000.02710.38
5.1.10.0030.02710.09
5.1.00.0000.02710.13
5.0.50.0000.0238.59
5.0.40.0000.0208.48
5.0.30.0030.0308.23
5.0.20.0000.0278.26
5.0.10.0000.0278.07
5.0.00.0030.0478.02
4.4.90.0000.0177.86
4.4.80.0000.0337.86
4.4.70.0000.0137.86
4.4.60.0000.0177.86
4.4.50.0000.0377.86
4.4.40.0000.0237.86
4.4.30.0000.0137.86
4.4.20.0000.0137.86
4.4.10.0000.0207.86
4.4.00.0070.0207.86
4.3.110.0000.0177.86
4.3.100.0030.0137.86
4.3.90.0000.0137.86
4.3.80.0030.0277.86
4.3.70.0000.0177.86
4.3.60.0000.0137.86
4.3.50.0000.0177.86
4.3.40.0000.0237.86
4.3.30.0030.0137.86
4.3.20.0000.0177.86
4.3.10.0000.0177.86
4.3.00.0000.0177.86

preferences:
46.11 ms | 401 KiB | 5 Q