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); $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' ))); var_dump(array_values(array_map(function($obj){ return $obj->format('d/m/Y'); },$datesWS))); /* // 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)
7.4.00.0100.00615.00
7.3.120.0060.01315.18
7.3.110.0070.00715.06
7.3.100.0080.00815.37
7.3.90.0080.00915.28
7.3.80.0070.00715.26
7.3.70.0050.01214.91
7.3.60.0070.01014.99
7.3.50.0050.00814.80
7.3.40.0020.01314.97
7.3.30.0090.00714.94
7.3.20.0070.00816.88
7.3.10.0050.01016.85
7.3.00.0100.00816.85
7.2.250.0130.00715.35
7.2.240.0090.00815.39
7.2.230.0040.00915.56
7.2.220.0030.01115.45
7.2.210.0050.01015.48
7.2.200.0110.00515.48
7.2.190.0070.00915.29
7.2.180.0020.01115.36
7.2.170.0080.01115.34
7.2.160.0030.01015.39
7.2.150.0080.00517.10
7.2.140.0090.00917.04
7.2.130.0050.01317.03
7.2.120.0060.00916.97
7.2.110.0100.00816.92
7.2.100.0030.01017.19
7.2.90.0050.01417.10
7.2.80.0030.01117.23
7.2.70.0040.01017.24
7.2.60.0030.01117.06
7.2.50.0020.01617.01
7.2.40.0060.00817.33
7.2.30.0070.00917.08
7.2.20.0110.00216.98
7.2.10.0070.00716.96
7.2.00.0070.00817.86
7.1.330.0050.01015.97
7.1.320.0050.01216.19
7.1.310.0030.01016.01
7.1.300.0020.01015.88
7.1.290.0070.00715.97
7.1.280.0080.00715.93
7.1.270.0010.01115.98
7.1.260.0030.01016.05
7.1.250.0090.00715.78
7.1.240.0030.00915.99
7.1.230.0060.00915.79
7.1.220.0090.00615.91
7.1.210.0130.00615.87
7.1.200.0000.01416.04
7.1.190.0060.00916.16
7.1.180.0060.00915.58
7.1.170.0130.00316.14
7.1.160.0040.00716.04
7.1.150.0110.00415.60
7.1.140.0000.01515.98
7.1.130.0030.01016.14
7.1.120.0060.00915.78
7.1.110.0000.01016.19
7.1.100.0070.01015.93
7.1.90.0030.01216.08
7.1.80.0040.01216.01
7.1.70.0070.00716.55
7.1.60.0080.01317.66
7.1.50.0100.01216.65
7.1.40.0040.01215.95
7.1.30.0030.01015.77
7.1.20.0040.01515.64
7.1.10.0060.00916.13
7.1.00.0070.02519.15
7.0.330.0090.00315.50
7.0.320.0100.00715.34
7.0.310.0050.00515.35
7.0.300.0030.00815.35
7.0.290.0090.00315.63
7.0.280.0060.01015.32
7.0.270.0000.01115.70
7.0.260.0100.00715.51
7.0.250.0070.00715.44
7.0.240.0030.01015.76
7.0.230.0070.00715.56
7.0.220.0060.01015.44
7.0.210.0060.00915.61
7.0.200.0230.00615.20
7.0.190.0040.00815.38
7.0.180.0090.00315.59
7.0.170.0070.01015.51
7.0.160.0000.01015.59
7.0.150.0060.00615.64
7.0.140.0070.04018.74
7.0.130.0030.00615.69
7.0.120.0030.04518.86
7.0.110.0030.00615.57
7.0.100.0030.01015.56
7.0.90.0100.00315.45
7.0.80.0090.00615.53
7.0.70.0000.01815.62
7.0.60.0060.04718.14
7.0.50.0080.04517.27
7.0.40.0110.02217.20
7.0.30.0150.04817.24
7.0.20.0170.04517.21
7.0.10.0160.04317.16
7.0.00.0060.02817.06
5.6.400.0080.01114.52
5.6.390.0130.00314.45
5.6.380.0000.02114.30
5.6.370.0030.01214.31
5.6.360.0070.00414.57
5.6.350.0070.00714.79
5.6.340.0030.01314.79
5.6.330.0060.00914.58
5.6.320.0070.01114.91
5.6.310.0070.01014.73
5.6.300.0030.01014.67
5.6.290.0110.00414.66
5.6.280.0110.03617.86
5.6.270.0030.01014.44
5.6.260.0030.01314.54
5.6.250.0040.01214.60
5.6.240.0080.00414.75
5.6.230.0040.00714.56
5.6.220.0100.00714.71
5.6.210.0120.04217.83
5.6.200.0030.02616.39
5.6.190.0050.04417.82
5.6.180.0170.04217.62
5.6.170.0130.03117.72
5.6.160.0100.02517.85
5.6.150.0070.04416.42
5.6.140.0070.04416.50
5.6.130.0050.04216.37
5.6.120.0070.05017.88
5.6.110.0000.02917.99
5.6.100.0020.02817.86
5.6.90.0060.04717.92
5.6.80.0050.04717.59
5.6.70.0130.04117.62
5.6.60.0140.00314.48
5.6.50.0090.00314.70
5.6.40.0030.01014.38
5.6.30.0030.01114.74
5.6.20.0080.00414.79
5.6.10.0090.00614.43
5.6.00.0090.00314.61
5.5.380.0040.01114.86
5.5.370.0090.00614.63
5.5.360.0000.01214.83
5.5.350.0130.04717.68
5.5.340.0090.03216.35
5.5.330.0030.04917.46
5.5.320.0100.04017.49
5.5.310.0150.04117.54
5.5.300.0030.04116.16
5.5.290.0010.03916.20
5.5.280.0060.02517.75
5.5.270.0030.03417.96
5.5.260.0080.03817.85
5.5.250.0100.03217.70
5.5.240.0050.04617.43
5.5.230.0050.00514.40
5.5.220.0030.00914.43
5.5.210.0140.00014.64
5.5.200.0060.01014.86
5.5.190.0040.01114.26
5.5.180.0040.00814.36
5.5.170.0040.01114.43
5.5.160.0060.00914.21
5.5.150.0030.01014.61
5.5.140.0040.01114.40
5.5.130.0070.00314.40
5.5.120.0060.00614.44
5.5.110.0070.00414.80
5.5.100.0040.00814.45
5.5.90.0130.00014.73
5.5.80.0030.01014.66
5.5.70.0040.01114.56
5.5.60.0000.01814.43
5.5.50.0070.00714.61
5.5.40.0040.01114.63
5.5.30.0060.01314.76
5.5.20.0030.01414.37
5.5.10.0030.01314.40
5.5.00.0000.01414.00
5.4.450.0100.03215.27
5.4.440.0060.02415.34
5.4.430.0070.03415.34
5.4.420.0070.02115.62
5.4.410.0050.02515.42
5.4.400.0100.04215.43
5.4.390.0080.02115.31
5.4.380.0070.04015.26
5.4.370.0020.03515.18
5.4.360.0080.04315.24
5.4.350.0110.03215.33
5.4.340.0080.03315.22
5.4.330.0100.00311.59
5.4.320.0050.04314.93
5.4.310.0070.02715.31
5.4.300.0070.04215.28
5.4.290.0070.03715.31
5.4.280.0050.03515.27
5.4.270.0080.03815.08
5.4.260.0050.04015.31
5.4.250.0030.03015.26
5.4.240.0050.03015.24
5.4.230.0080.03815.11
5.4.220.0020.02514.92
5.4.210.0030.02815.12
5.4.200.0070.04315.36
5.4.190.0000.02915.37
5.4.180.0040.02615.30
5.4.170.0070.02715.25
5.4.160.0050.02815.24
5.4.150.0080.03915.18
5.4.140.0030.04214.02
5.4.130.0090.02213.88
5.4.120.0000.02913.99
5.4.110.0030.02514.00
5.4.100.0090.02513.96
5.4.90.0050.02413.98
5.4.80.0030.03213.80
5.4.70.0060.02314.03
5.4.60.0050.02214.11
5.4.50.0100.03713.96
5.4.40.0080.02813.88
5.4.30.0050.04113.93
5.4.20.0050.02413.96
5.4.10.0020.02713.98
5.4.00.0030.02913.71
5.3.290.0070.04212.83
5.3.280.0020.03612.87
5.3.270.0020.03312.91
5.3.260.0050.04513.00
5.3.250.0070.03812.91
5.3.240.0070.04312.74
5.3.230.0050.04312.90
5.3.220.0030.02512.73
5.3.210.0100.03212.85
5.3.200.0070.02312.71
5.3.190.0030.03912.91
5.3.180.0100.03512.89
5.3.170.0030.02812.92
5.3.160.0050.02412.98
5.3.150.0010.02812.89
5.3.140.0070.04212.89
5.3.130.0070.02912.87
5.3.120.0030.03212.87
5.3.110.0050.03712.86
5.3.100.0090.03912.52
5.3.90.0040.02612.65
5.3.80.0070.02012.44
5.3.70.0080.02112.58
5.3.60.0040.02212.51
5.3.50.0020.02312.41
5.3.40.0080.02012.53
5.3.30.0050.04312.56
5.3.20.0070.03212.33
5.3.10.0020.02012.36
5.3.00.0050.02312.40
5.2.170.0000.04711.00
5.2.160.0100.03311.14
5.2.150.0030.03011.15
5.2.140.0030.03711.15
5.2.130.0070.02711.00
5.2.120.0030.03011.07
5.2.110.0000.03011.11
5.2.100.0000.03011.11
5.2.90.0000.03011.26
5.2.80.0000.03010.98
5.2.70.0030.03011.03
5.2.60.0000.03011.04
5.2.50.0030.03010.95
5.2.40.0000.03010.82
5.2.30.0030.02710.82
5.2.20.0000.03011.04
5.2.10.0030.02710.91
5.2.00.0000.03010.61
5.1.60.0030.02310.06
5.1.50.0030.0239.95
5.1.40.0030.0209.96
5.1.30.0030.02710.19
5.1.20.0070.02010.24
5.1.10.0000.03010.05
5.1.00.0030.02310.05
5.0.50.0070.0178.58
5.0.40.0000.0208.58
5.0.30.0000.0308.58
5.0.20.0000.0208.58
5.0.10.0000.0208.58
5.0.00.0000.0308.58
4.4.90.0030.0138.58
4.4.80.0000.0178.58
4.4.70.0000.0178.58
4.4.60.0000.0178.58
4.4.50.0030.0138.58
4.4.40.0000.0238.58
4.4.30.0030.0278.58
4.4.20.0000.0178.58
4.4.10.0000.0238.58
4.4.00.0030.0238.58
4.3.110.0000.0138.58
4.3.100.0000.0138.58
4.3.90.0000.0138.58
4.3.80.0000.0238.58
4.3.70.0000.0138.58
4.3.60.0000.0178.58
4.3.50.0000.0208.58
4.3.40.0030.0238.58
4.3.30.0000.0178.58
4.3.20.0030.0178.58
4.3.10.0000.0138.58
4.3.00.0000.0138.58

preferences:
45.56 ms | 401 KiB | 5 Q