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'); },$datesRange))); /* // 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.10.0110.00915.25
7.4.00.0040.01615.14
7.3.130.0080.00915.30
7.3.120.0110.00815.24
7.3.110.0130.00614.96
7.3.100.0080.01014.99
7.3.90.0080.00815.08
7.3.80.0080.00915.18
7.3.70.0100.00815.01
7.3.60.0100.00815.28
7.3.50.0030.01015.10
7.3.40.0100.00615.13
7.3.30.0030.00915.25
7.3.20.0070.00816.97
7.3.10.0110.00616.73
7.3.00.0050.01116.81
7.2.260.0080.00815.27
7.2.250.0060.01315.27
7.2.240.0070.01015.48
7.2.230.0070.01015.30
7.2.220.0070.01015.32
7.2.210.0040.01015.48
7.2.200.0040.01115.24
7.2.190.0050.00715.19
7.2.180.0050.01215.32
7.2.170.0080.00815.27
7.2.160.0070.01215.32
7.2.150.0030.01317.07
7.2.140.0090.00617.08
7.2.130.0090.00716.93
7.2.120.0040.01317.23
7.2.110.0100.00617.22
7.2.100.0060.01017.07
7.2.90.0050.01017.17
7.2.80.0030.01117.13
7.2.70.0070.00917.18
7.2.60.0050.01317.12
7.2.50.0050.00717.19
7.2.40.0100.00517.21
7.2.30.0080.00817.21
7.2.20.0090.00717.11
7.2.10.0050.01217.20
7.2.00.0090.00617.13
7.1.330.0060.00815.96
7.1.320.0060.01116.04
7.1.310.0030.01015.87
7.1.300.0080.00615.97
7.1.290.0020.01015.91
7.1.280.0060.00716.14
7.1.270.0070.00915.99
7.1.260.0030.01015.93
7.1.250.0070.00616.16
7.1.240.0050.00615.96
7.1.230.0030.01516.13
7.1.220.0030.01316.04
7.1.210.0000.01215.93
7.1.200.0080.00816.08
7.1.190.0020.01516.06
7.1.180.0030.00916.08
7.1.170.0070.00716.13
7.1.160.0060.00815.95
7.1.150.0000.01516.04
7.1.140.0100.00515.97
7.1.130.0050.00815.90
7.1.120.0050.01215.98
7.1.110.0050.00816.11
7.1.100.0060.00616.02
7.1.90.0060.00716.02
7.1.80.0050.01015.98
7.1.70.0020.01016.37
7.1.60.0070.00616.47
7.1.50.0050.01216.41
7.1.40.0040.00916.13
7.1.30.0030.01216.02
7.1.20.0030.01016.00
7.1.10.0080.00716.08
7.1.00.0060.01518.16
7.0.330.0030.01115.63
7.0.320.0070.00715.57
7.0.310.0080.00315.43
7.0.300.0030.01115.57
7.0.290.0050.01015.56
7.0.280.0020.01115.51
7.0.270.0010.00715.60
7.0.260.0070.00815.56
7.0.250.0060.00515.72
7.0.240.0040.01115.59
7.0.230.0060.00615.63
7.0.220.0060.00515.42
7.0.210.0080.00815.74
7.0.200.0030.01216.08
7.0.190.0050.00915.61
7.0.180.0040.00715.53
7.0.170.0020.01215.61
7.0.160.0060.01015.67
7.0.150.0030.00815.57
7.0.140.0050.03017.83
7.0.130.0080.00615.68
7.0.120.0050.00815.63
7.0.110.0060.00715.61
7.0.100.0090.00415.71
7.0.90.0070.00715.55
7.0.80.0040.03417.14
7.0.70.0070.02317.06
7.0.60.0070.02717.56
7.0.50.0050.03217.54
7.0.40.0070.03316.17
7.0.30.0050.02616.15
7.0.20.0090.01616.21
7.0.10.0060.03316.08
7.0.00.0090.02216.08
5.6.400.0030.01014.72
5.6.390.0060.01114.48
5.6.380.0020.01114.37
5.6.370.0040.01314.55
5.6.360.0040.01214.75
5.6.350.0030.01114.69
5.6.340.0070.00814.85
5.6.330.0030.01114.71
5.6.320.0060.00614.66
5.6.310.0070.00714.61
5.6.300.0080.00614.72
5.6.290.0060.00714.89
5.6.280.0060.03116.86
5.6.270.0090.00414.87
5.6.260.0120.00314.70
5.6.250.0070.00514.60
5.6.240.0050.00914.89
5.6.230.0090.01816.84
5.6.220.0120.03016.81
5.6.210.0080.02016.64
5.6.200.0070.03116.91
5.6.190.0080.03217.00
5.6.180.0100.03016.80
5.6.170.0050.02116.88
5.6.160.0120.01816.91
5.6.150.0060.03316.85
5.6.140.0100.03016.78
5.6.130.0070.02816.73
5.6.120.0080.03116.81
5.6.110.0080.03616.76
5.6.100.0060.03216.97
5.6.90.0050.03616.86
5.6.80.0100.01716.58
5.6.70.0060.03416.47
5.6.60.0080.02116.53
5.6.50.0040.02316.46
5.6.40.0070.03116.65
5.6.30.0110.02616.56
5.6.20.0090.01916.47
5.6.10.0070.02916.51
5.6.00.0070.02516.56
5.5.380.0050.00914.75
5.5.370.0110.02716.66
5.5.360.0070.03116.60
5.5.350.0100.02916.84
5.5.340.0060.03616.83
5.5.330.0080.02216.71
5.5.320.0090.02916.69
5.5.310.0060.01916.76
5.5.300.0090.03316.76
5.5.290.0020.03616.76
5.5.280.0070.02716.80
5.5.270.0050.03116.82
5.5.260.0050.02516.72
5.5.250.0090.03116.68
5.5.240.0070.03316.56
5.5.230.0070.02816.45
5.5.220.0090.02716.62
5.5.210.0090.01916.54
5.5.200.0080.02716.61
5.5.190.0090.03116.50
5.5.180.0030.03416.48
5.5.170.0040.00914.53
5.5.160.0060.03316.60
5.5.150.0090.02516.61
5.5.140.0050.02116.42
5.5.130.0070.03316.45
5.5.120.0050.03416.49
5.5.110.0080.01816.65
5.5.100.0070.02316.29
5.5.90.0070.02816.40
5.5.80.0020.03916.45
5.5.70.0050.02416.45
5.5.60.0050.03416.42
5.5.50.0020.03516.53
5.5.40.0050.02416.46
5.5.30.0080.03016.41
5.5.20.0090.02916.44
5.5.10.0050.02516.30
5.5.00.0080.02816.47
5.4.450.0060.03214.54
5.4.440.0030.03014.46
5.4.430.0030.03114.56
5.4.420.0030.02114.56
5.4.410.0040.02614.52
5.4.400.0050.03114.48
5.4.390.0040.03014.42
5.4.380.0040.01914.42
5.4.370.0020.02614.47
5.4.360.0020.03414.42
5.4.350.0070.03014.46
5.4.340.0030.03014.45
5.4.330.0030.01012.09
5.4.320.0070.03114.44
5.4.310.0080.02514.42
5.4.300.0040.02314.36
5.4.290.0020.02314.45
5.4.280.0040.03214.42
5.4.270.0040.02614.42
5.4.260.0030.02314.47
5.4.250.0050.03114.36
5.4.240.0090.01714.48
5.4.230.0050.02114.37
5.4.220.0080.03014.47
5.4.210.0050.02214.47
5.4.200.0030.03314.47
5.4.190.0090.02614.45
5.4.180.0070.03014.44
5.4.170.0040.02314.41
5.4.160.0080.02014.45
5.4.150.0050.02414.45
5.4.140.0050.03013.56
5.4.130.0090.02013.57
5.4.120.0040.03313.58
5.4.110.0050.03113.59
5.4.100.0050.02913.57
5.4.90.0040.03013.57
5.4.80.0080.02813.54
5.4.70.0050.02413.53
5.4.60.0050.01713.56
5.4.50.0040.03013.58
5.4.40.0090.02113.50
5.4.30.0050.02713.57
5.4.20.0040.02713.56
5.4.10.0050.02113.54
5.4.00.0060.03213.41
5.3.290.0070.03113.05
5.3.280.0050.03412.98
5.3.270.0030.03212.99
5.3.260.0030.03013.00
5.3.250.0060.02913.00
5.3.240.0090.01713.00
5.3.230.0040.03612.99
5.3.220.0100.02713.01
5.3.210.0070.02912.94
5.3.200.0080.01712.95
5.3.190.0070.02812.97
5.3.180.0050.03012.96
5.3.170.0040.03012.94
5.3.160.0100.02713.01
5.3.150.0060.02812.95
5.3.140.0080.02312.94
5.3.130.0050.03112.99
5.3.120.0060.02612.98
5.3.110.0060.02112.99
5.3.100.0050.03012.84
5.3.90.0080.02912.79
5.3.80.0050.03112.80
5.3.70.0050.02812.78
5.3.60.0020.02712.81
5.3.50.0050.02912.76
5.3.40.0080.02712.78
5.3.30.0060.02912.78
5.3.20.0040.02812.65
5.3.10.0060.02912.66
5.3.00.0060.02912.72
5.2.170.0070.03011.77
5.2.160.0030.06011.77
5.2.150.0030.03711.77
5.2.140.0000.03311.77
5.2.130.0030.06311.77
5.2.120.0070.06011.77
5.2.110.0030.03711.77
5.2.100.0000.06011.77
5.2.90.0030.03311.77
5.2.80.0030.06011.77
5.2.70.0100.05711.77
5.2.60.0070.05711.77
5.2.50.0100.04011.77
5.2.40.0000.05711.77
5.2.30.0100.02711.77
5.2.20.0030.04711.77
5.2.10.0000.06011.77
5.2.00.0030.06011.77
5.1.60.0070.05011.77
5.1.50.0070.05011.77
5.1.40.0100.04711.77
5.1.30.0070.05011.77
5.1.20.0070.05711.77
5.1.10.0030.04711.77
5.1.00.0070.04311.77
5.0.50.0070.03011.77
5.0.40.0030.03011.77
5.0.30.0030.03311.77
5.0.20.0030.02011.77
5.0.10.0000.02711.77
5.0.00.0170.02311.77
4.4.90.0030.03711.77
4.4.80.0000.03011.77
4.4.70.0030.02011.77
4.4.60.0000.02011.77
4.4.50.0030.02311.77
4.4.40.0070.05311.77
4.4.30.0070.03011.77
4.4.20.0130.02011.77
4.4.10.0000.03711.77
4.4.00.0070.04711.77
4.3.110.0030.03311.77
4.3.100.0100.03011.77
4.3.90.0070.03011.77
4.3.80.0070.05311.77
4.3.70.0030.03311.77
4.3.60.0000.03011.77
4.3.50.0070.03011.77
4.3.40.0000.05311.77
4.3.30.0000.03311.77
4.3.20.0000.03011.77
4.3.10.0000.03711.77
4.3.00.0070.03011.77

preferences:
38.9 ms | 400 KiB | 5 Q