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,31); foreach($months AS $month) foreach($days AS $day) $datesWS[] = new DateTime(implode('-',array($year,$month,$day))); // Push DateTime object to the WebService array // 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 var_dump(array_shift($datesWS)); var_dump(array_pop($datesWS)); /* $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 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'); } // 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)
8.3.60.0140.00718.38
8.3.50.0130.00521.08
8.3.40.0070.01418.71
8.3.30.0150.00418.94
8.3.20.0000.00818.86
8.3.10.0100.01020.39
8.3.00.0050.00321.84
8.2.180.0090.00917.00
8.2.170.0090.00622.96
8.2.160.0070.00722.08
8.2.150.0000.00824.18
8.2.140.0040.00424.66
8.2.130.0180.00026.16
8.2.120.0030.00719.68
8.2.110.0030.00620.99
8.2.100.0090.00617.84
8.2.90.0030.00519.17
8.2.80.0050.00517.97
8.2.70.0070.00417.88
8.2.60.0030.00618.18
8.2.50.0050.00318.16
8.2.40.0050.00318.16
8.2.30.0080.00019.84
8.2.20.0040.00418.02
8.2.10.0080.00017.89
8.2.00.0040.00417.86
8.1.280.0110.01125.92
8.1.270.0080.00023.99
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0120.00020.90
8.1.230.0070.00420.99
8.1.220.0040.00418.77
8.1.210.0060.00319.00
8.1.200.0030.00717.73
8.1.190.0050.00317.75
8.1.180.0030.00718.10
8.1.170.0030.00619.09
8.1.160.0000.00718.89
8.1.150.0040.00418.88
8.1.140.0000.00817.62
8.1.130.0040.00418.05
8.1.120.0000.00717.73
8.1.110.0000.00817.62
8.1.100.0040.00417.63
8.1.90.0030.00517.76
8.1.80.0000.00717.66
8.1.70.0000.00717.68
8.1.60.0000.00817.68
8.1.50.0080.00017.56
8.1.40.0040.00417.74
8.1.30.0050.00317.83
8.1.20.0050.00517.79
8.1.10.0000.00817.77
8.1.00.0060.00317.83
8.0.300.0030.00620.16
8.0.290.0030.00617.13
8.0.280.0040.00418.57
8.0.270.0000.00717.37
8.0.260.0030.00317.05
8.0.250.0040.00417.27
8.0.240.0060.00317.25
8.0.230.0000.00817.15
8.0.220.0050.00317.24
8.0.210.0000.00717.17
8.0.200.0000.00817.11
8.0.190.0040.00417.25
8.0.180.0050.00217.18
8.0.170.0040.00417.03
8.0.160.0040.00417.05
8.0.150.0030.00617.06
8.0.140.0060.00317.04
8.0.130.0030.00313.49
8.0.120.0030.00617.15
8.0.110.0040.00417.25
8.0.100.0030.00617.17
8.0.90.0020.00517.23
8.0.80.0070.01017.09
8.0.70.0040.00417.01
8.0.60.0030.00517.11
8.0.50.0040.00417.11
8.0.30.0080.01117.19
8.0.20.0130.01917.50
8.0.10.0080.00017.13
8.0.00.0090.01217.08
7.4.330.0030.00314.79
7.4.320.0040.00416.77
7.4.300.0000.00716.70
7.4.290.0070.00016.70
7.4.280.0080.00016.63
7.4.270.0070.00316.82
7.4.260.0030.00313.43
7.4.250.0030.00616.78
7.4.240.0040.00416.86
7.4.230.0070.00016.58
7.4.220.0060.01216.66
7.4.210.0110.00416.74
7.4.200.0030.00316.89
7.4.190.0040.00416.82
7.4.160.0070.01516.62
7.4.150.0070.01517.40
7.4.140.0110.00817.86
7.4.130.0120.00816.77
7.4.120.0110.00816.83
7.4.110.0150.00616.68
7.4.100.0130.00916.71
7.4.90.0080.01316.74
7.4.80.0090.00919.04
7.4.70.0060.01116.71
7.4.60.0080.01116.61
7.4.50.0000.00816.59
7.4.40.0080.00422.27
7.4.30.0100.00616.93
7.4.00.0060.01315.22
7.3.330.0030.00313.31
7.3.320.0000.00713.45
7.3.310.0000.00716.47
7.3.300.0000.00816.32
7.3.290.0000.01516.46
7.3.280.0040.01216.47
7.3.270.0150.00317.40
7.3.260.0100.00918.24
7.3.250.0120.00616.72
7.3.240.0210.00316.80
7.3.230.0090.00916.52
7.3.210.0090.00916.34
7.3.200.0160.00319.39
7.3.190.0120.00916.64
7.3.180.0080.00816.34
7.3.170.0130.00616.71
7.3.160.0100.01316.49
7.3.120.0060.01115.15
7.3.110.0090.00915.17
7.3.100.0030.01314.71
7.3.90.0000.01415.05
7.3.80.0060.00615.25
7.3.70.0070.00615.09
7.3.60.0070.00715.00
7.3.50.0000.01415.09
7.3.40.0060.01014.80
7.3.30.0080.00415.00
7.3.20.0030.00616.94
7.3.10.0060.00816.88
7.3.00.0080.00516.67
7.2.330.0090.00916.89
7.2.320.0060.01016.72
7.2.310.0140.00616.67
7.2.300.0080.00816.68
7.2.290.0100.00716.64
7.2.250.0120.00614.90
7.2.240.0170.00315.32
7.2.230.0100.00615.43
7.2.220.0030.01014.96
7.2.210.0000.01515.12
7.2.200.0090.00615.20
7.2.190.0030.01215.36
7.2.180.0070.01015.19
7.2.170.0060.00315.11
7.2.130.0110.00416.95
7.2.120.0090.00617.02
7.2.110.0030.01316.88
7.2.100.0090.00317.03
7.2.90.0140.01016.86
7.2.80.0160.00016.98
7.2.70.0090.00616.96
7.2.60.0150.00316.87
7.2.50.0170.00017.26
7.2.40.0040.00717.14
7.2.30.0060.00617.11
7.2.20.0030.00916.72
7.2.10.0040.00717.02
7.2.00.0070.01016.79
7.1.330.0040.01115.79
7.1.320.0090.00616.09
7.1.310.0080.00616.03
7.1.300.0070.00415.86
7.1.290.0090.00316.07
7.1.280.0060.00315.65
7.1.270.0070.00715.75
7.1.260.0030.01315.99
7.1.250.0030.00715.80
5.4.100.0100.00013.61
5.4.90.0100.00313.61
5.4.80.0090.00613.61
5.4.70.0070.00313.61
5.4.60.0080.00413.61
5.4.50.0040.00813.61
5.4.40.0040.00413.61
5.4.30.0020.00713.61
5.4.20.0050.00513.61
5.4.10.0000.01013.61
5.4.00.0090.00213.61
5.3.200.0030.00713.61
5.3.190.0000.01313.61
5.3.180.0000.01113.61
5.3.170.0090.00313.61
5.3.160.0040.00713.61
5.3.150.0030.00813.61
5.3.140.0070.00413.61
5.3.130.0090.00513.61
5.3.120.0050.00813.61
5.3.110.0100.00313.61
5.3.100.0000.00913.61
5.3.90.0030.00813.61
5.3.80.0060.00313.61
5.3.70.0040.00413.61
5.3.60.0030.00913.61
5.3.50.0050.00713.61
5.3.40.0030.00613.61
5.3.30.0080.00313.61
5.3.20.0080.00313.61
5.3.10.0040.00713.61
5.3.00.0030.00613.61
5.2.170.0050.00513.61
5.2.160.0070.00013.61
5.2.150.0070.00013.61
5.2.140.0090.00013.61
5.2.130.0000.00913.61
5.2.120.0060.00313.61
5.2.110.0040.00413.61
5.2.100.0060.00313.61
5.2.90.0030.00613.61
5.2.80.0040.00413.61
5.2.70.0070.00013.61
5.2.60.0000.00813.61
5.2.50.0060.00013.61
5.2.40.0000.00913.61
5.2.30.0030.00513.61
5.2.20.0000.00813.61
5.2.10.0050.00213.61
5.2.00.0000.01013.61
5.1.60.0020.00513.61
5.1.50.0030.00513.61
5.1.40.0030.00613.61
5.1.30.0050.00213.61
5.1.20.0040.00413.61
5.1.10.0030.00313.61
5.1.00.0030.00313.61
5.0.50.0050.00213.61
5.0.40.0040.00413.61
5.0.30.0060.00013.61
5.0.20.0060.00013.61
5.0.10.0070.00013.61
5.0.00.0040.00213.61
4.4.90.0000.00513.61
4.4.80.0000.00513.61
4.4.70.0030.00313.61
4.4.60.0050.00013.61
4.4.50.0000.00413.61
4.4.40.0000.00513.61
4.4.30.0030.00313.61
4.4.20.0000.00413.61
4.4.10.0000.00513.61
4.4.00.0050.00013.61
4.3.110.0000.00613.61
4.3.100.0000.00513.61
4.3.90.0000.00413.61
4.3.80.0030.00313.61
4.3.70.0000.00513.61
4.3.60.0050.00013.61
4.3.50.0030.00313.61
4.3.40.0030.00313.61
4.3.30.0000.00413.61
4.3.20.0040.00013.61
4.3.10.0000.00413.61
4.3.00.0060.00013.61

preferences:
46.43 ms | 400 KiB | 5 Q