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($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.00.0100.01016.94
7.2.130.0090.01817.13
7.2.120.0160.01017.13
7.2.110.0180.00916.75
7.2.100.0070.02417.06
7.2.90.0080.01617.05
7.2.80.0150.01516.99
7.2.70.0090.01617.19
7.2.60.0290.00616.89
7.2.50.0070.01817.38
7.2.40.0090.01917.05
7.2.30.0080.01917.27
7.2.20.0060.01917.32
7.2.10.0120.01217.02
7.2.00.0070.01618.41
7.1.250.0060.01616.03
7.1.240.0040.02315.68
7.1.230.0100.02016.04
7.1.220.0170.01015.95
7.1.210.0140.01116.08
7.1.200.0070.02315.71
7.1.190.0150.01116.08
7.1.180.0080.01616.14
7.1.170.0090.01615.94
7.1.160.0070.01316.08
7.1.150.0060.01916.01
7.1.140.0090.01515.98
7.1.130.0100.01415.77
7.1.120.0090.01716.06
7.1.110.0070.02016.17
7.1.100.0040.02216.14
7.1.90.0060.01915.73
7.1.80.0100.01616.03
7.1.70.0050.01716.63
7.1.60.0090.01416.55
7.1.50.0080.01816.67
7.1.40.0070.01916.05
7.1.30.0110.01816.10
7.1.20.0040.02615.85
7.1.10.0120.01215.86
7.1.00.0090.02519.08
7.0.330.0130.01315.51
7.0.320.0100.02015.58
7.0.310.0070.02015.47
7.0.300.0070.02315.32
7.0.290.0150.01115.46
7.0.280.0030.02015.35
7.0.270.0150.01215.36
7.0.260.0130.01315.41
7.0.250.0090.01215.46
7.0.240.0030.02815.56
7.0.230.0070.01915.41
7.0.220.0040.02115.40
7.0.210.0110.01815.52
7.0.200.0070.01916.16
7.0.190.0130.01415.65
7.0.180.0100.02215.40
7.0.170.0140.02015.42
7.0.160.0170.01715.57
7.0.150.0130.01315.31
7.0.140.0050.04918.72
7.0.130.0160.01615.59
7.0.120.0100.05018.71
7.0.110.0170.01415.55
7.0.100.0140.01715.61
7.0.90.0280.01315.30
7.0.80.0030.01615.13
7.0.70.0100.02015.61
7.0.60.0090.03918.22
7.0.50.0080.04917.15
7.0.40.0070.05417.28
7.0.30.0240.03017.26
7.0.20.0220.04017.36
7.0.10.0140.04517.04
7.0.00.0030.04517.14
5.6.380.0060.01614.21
5.6.370.0070.02014.87
5.6.360.0130.01314.93
5.6.350.0060.01814.57
5.6.340.0070.02014.58
5.6.330.0040.01814.55
5.6.320.0070.01014.33
5.6.310.0070.02114.59
5.6.300.0120.01814.72
5.6.290.0030.01514.49
5.6.280.0130.04517.88
5.6.270.0070.02014.77
5.6.260.0100.01614.34
5.6.250.0030.01914.75
5.6.240.0070.02114.59
5.6.230.0070.01714.42
5.6.220.0130.01314.36
5.6.210.0020.04117.71
5.6.200.0050.03816.53
5.6.190.0120.05217.53
5.6.180.1520.03817.76
5.6.170.0220.04017.55
5.6.160.0080.05717.60
5.6.150.0080.05316.37
5.6.140.0070.02916.45
5.6.130.0030.03516.45
5.6.120.0080.05717.77
5.6.110.0120.05218.06
5.6.100.0100.03117.79
5.6.90.0120.04217.86
5.6.80.0050.04417.50
5.6.70.2310.02617.53
5.6.60.0000.02614.48
5.6.50.0110.01414.25
5.6.40.0030.02114.65
5.6.30.0090.01214.54
5.6.20.0140.01014.64
5.6.10.0030.01914.41
5.6.00.0110.01114.70
5.5.380.0100.01011.67
5.5.370.0150.01111.48
5.5.360.0060.01511.39
5.5.350.0180.05015.88
5.5.340.0030.04114.77
5.5.330.0100.05315.91
5.5.320.0150.03115.80
5.5.310.0180.03916.05
5.5.300.0070.05414.71
5.5.290.0050.03214.69
5.5.280.0070.05716.30
5.5.270.0070.03416.11
5.5.260.0040.04316.07
5.5.250.0130.03516.03
5.5.240.0180.04015.87
5.5.230.0090.01211.28
5.5.220.0070.01711.45
5.5.210.0080.01611.26
5.5.200.0000.02411.22
5.5.190.0030.01311.48
5.5.180.0070.01811.32
5.5.170.0070.01711.40
5.5.160.0040.01611.49
5.5.150.0060.01911.30
5.5.140.0030.01911.59
5.5.130.0110.01111.37
5.5.120.0030.01911.46
5.5.110.0100.01011.57
5.5.100.0070.02011.33
5.5.90.0030.02111.39
5.5.80.0060.01911.48
5.5.70.0090.00911.52
5.5.60.0050.01810.88
5.5.50.0030.01811.22
5.5.40.0040.02711.12
5.5.30.0040.02511.48
5.5.20.0040.01511.39
5.5.10.0130.01011.17
5.5.00.0100.01311.55
5.4.450.0020.03315.35
5.4.440.0130.04615.46
5.4.430.0070.03315.39
5.4.420.0030.04815.33
5.4.410.0090.03215.37
5.4.400.0020.03115.12
5.4.390.0050.03515.15
5.4.380.0020.04415.17
5.4.370.0040.03415.31
5.4.360.0070.03715.25
5.4.350.0050.03415.16
5.4.340.0090.04715.17
5.4.330.0060.01611.38
5.4.320.0060.03415.18
5.4.310.0050.04715.05
5.4.300.0020.04715.06
5.4.290.0030.04115.20
5.4.280.0060.05415.15
5.4.270.0050.05115.03
5.4.260.0080.03615.04
5.4.250.0120.04715.12
5.4.240.0050.05215.17
5.4.230.0050.05415.05
5.4.220.0030.05115.30
5.4.210.0020.03815.07
5.4.200.0060.03815.02
5.4.190.0060.03415.08
5.4.180.0040.04915.40
5.4.170.0050.03015.16
5.4.160.0090.03814.93
5.4.150.0090.03415.18
5.4.140.0050.05213.82
5.4.130.0080.02713.85
5.4.120.0030.05413.79
5.4.110.0030.03513.93
5.4.100.0030.04913.84
5.4.90.0100.03213.86
5.4.80.0050.03113.93
5.4.70.0030.05413.92
5.4.60.0050.04813.98
5.4.50.0100.04913.98
5.4.40.0030.04914.02
5.4.30.0050.03313.87
5.4.20.0050.05213.98
5.4.10.0030.04513.96
5.4.00.0080.05313.63
5.3.290.0100.04813.07
5.3.280.0030.04512.91
5.3.270.0030.03912.88
5.3.260.0070.02912.77
5.3.250.0080.04812.83
5.3.240.0050.04412.72
5.3.230.0030.03113.03
5.3.220.0050.05012.89
5.3.210.0040.03212.82
5.3.200.0030.03212.69
5.3.190.0090.04812.88
5.3.180.0070.04812.80
5.3.170.0050.04412.91
5.3.160.0110.04712.90
5.3.150.0030.04412.92
5.3.140.0080.03712.87
5.3.130.0040.03212.80
5.3.120.0050.04912.78
5.3.110.0080.05012.78
5.3.100.0030.04512.66
5.3.90.0050.05012.59
5.3.80.0030.04612.47
5.3.70.0060.04112.49
5.3.60.0040.04912.52
5.3.50.0080.05012.44
5.3.40.0050.04912.69
5.3.30.0080.03712.59
5.3.20.0070.03912.49
5.3.10.0080.05112.36
5.3.00.0020.05112.37
5.2.170.0030.03111.15
5.2.160.0030.03011.15
5.2.150.0020.03411.15
5.2.140.0000.03511.15
5.2.130.0030.01711.15
5.2.120.0030.02111.15
5.2.110.0020.03311.15
5.2.100.0020.03211.15
5.2.90.0020.02511.15
5.2.80.0020.02211.15
5.2.70.0040.03211.15
5.2.60.0060.02111.15
5.2.50.0020.02411.15
5.2.40.0030.03311.15
5.2.30.0000.02411.15
5.2.20.0030.03411.15
5.2.10.0060.02911.15
5.2.00.0020.03611.15
5.1.60.0040.02511.15
5.1.50.0050.02311.15
5.1.40.0030.02811.15
5.1.30.0020.02611.15
5.1.20.0010.01611.15
5.1.10.0000.01711.15
5.1.00.0030.01711.15
5.0.50.0020.01311.15
5.0.40.0040.01011.15
5.0.30.0030.01511.15
5.0.20.0030.00811.15
5.0.10.0010.01111.15
5.0.00.0010.01811.15
4.4.90.0030.01711.15
4.4.80.0030.01011.15
4.4.70.0000.02211.15
4.4.60.0030.01311.15
4.4.50.0020.01611.15
4.4.40.0010.02611.15
4.4.30.0020.02011.15
4.4.20.0010.01311.15
4.4.10.0020.00811.15
4.4.00.0000.01511.15
4.3.110.0050.00611.15
4.3.100.0040.00511.15
4.3.90.0000.00911.15
4.3.80.0010.01311.15
4.3.70.0000.01211.15
4.3.60.0020.01011.15
4.3.50.0000.00811.15
4.3.40.0000.01311.15
4.3.30.0020.00811.15
4.3.20.0020.01011.15
4.3.10.0020.01011.15
4.3.00.0000.01011.15

preferences:
35.5 ms | 401 KiB | 5 Q