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(array_values(array_map(function($obj){ return $obj->format('d/m/Y'); },$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.0040.01915.49
7.4.00.0100.01315.16
7.3.130.0070.01715.18
7.3.120.0100.01315.33
7.3.110.0080.01615.29
7.3.100.0070.01415.25
7.3.90.0020.02115.18
7.3.80.0050.01615.32
7.3.70.0080.00815.16
7.3.60.0050.01615.20
7.3.50.0020.01615.08
7.3.40.0090.00915.30
7.3.30.0090.00915.25
7.3.20.0060.00916.95
7.3.10.0060.01316.83
7.3.00.0030.01316.71
7.2.260.0110.01415.53
7.2.250.0080.01615.38
7.2.240.0090.01415.50
7.2.230.0070.01715.31
7.2.220.0030.01715.52
7.2.210.0050.01815.31
7.2.200.0050.01315.53
7.2.190.0050.01315.30
7.2.180.0070.00815.35
7.2.170.0050.00915.15
7.2.160.0060.01515.21
7.2.150.0040.01416.96
7.2.140.0070.01417.03
7.2.130.0040.01917.25
7.2.120.0000.01817.25
7.2.110.0090.00917.31
7.2.100.0000.02017.26
7.2.90.0000.01616.98
7.2.80.0110.00717.00
7.2.70.0030.02017.28
7.2.60.0070.01317.27
7.2.50.0070.01416.97
7.2.40.0090.01117.35
7.2.30.0100.01017.25
7.2.20.0000.01917.14
7.2.10.0000.02017.12
7.2.00.0020.01418.40
7.1.330.0080.01016.07
7.1.320.0030.01415.97
7.1.310.0100.00816.09
7.1.300.0050.01315.94
7.1.290.0070.01116.04
7.1.280.0030.01215.94
7.1.270.0080.00816.10
7.1.260.0070.01415.94
7.1.250.0060.01216.06
7.1.240.0000.01915.77
7.1.230.0070.01316.04
7.1.220.0060.01315.88
7.1.210.0040.01216.09
7.1.200.0070.01115.80
7.1.190.0040.01516.22
7.1.180.0040.01415.86
7.1.170.0090.01016.08
7.1.160.0030.01416.05
7.1.150.0030.01716.09
7.1.140.0030.01216.18
7.1.130.0060.00916.08
7.1.120.0030.01016.11
7.1.110.0090.01216.05
7.1.100.0060.01116.20
7.1.90.0060.00916.19
7.1.80.0040.00816.03
7.1.70.0030.01416.78
7.1.60.0080.01317.72
7.1.50.0060.01616.62
7.1.40.0040.01115.64
7.1.30.0030.01416.00
7.1.20.0000.01815.83
7.1.10.0030.01716.19
7.1.00.0050.05019.15
7.0.330.0060.00915.32
7.0.320.0030.01515.61
7.0.310.0000.02015.26
7.0.300.0030.01015.66
7.0.290.0040.01515.54
7.0.280.0070.01115.54
7.0.270.0120.00915.54
7.0.260.0040.01815.49
7.0.250.0090.00915.77
7.0.240.0090.00615.36
7.0.230.0000.01815.79
7.0.220.0000.01715.45
7.0.210.0090.00915.57
7.0.200.0080.00616.21
7.0.190.0030.01015.74
7.0.180.0090.00915.55
7.0.170.0070.01015.43
7.0.160.0030.01215.73
7.0.150.0030.01515.73
7.0.140.0030.05018.80
7.0.130.0060.01015.45
7.0.120.0090.00615.77
7.0.110.0060.00615.69
7.0.100.0090.02317.76
7.0.90.0050.02817.82
7.0.80.0030.02917.86
7.0.70.0060.02517.90
7.0.60.0070.03018.21
7.0.50.0080.03018.21
7.0.40.0070.02517.12
7.0.30.0080.02817.26
7.0.20.0030.02817.32
7.0.10.0000.03317.30
7.0.00.0030.02517.27
5.6.400.0000.01615.08
5.6.390.0090.00914.66
5.6.380.0040.01514.71
5.6.370.0100.01314.71
5.6.360.0040.01514.66
5.6.350.0070.01014.76
5.6.340.0000.02114.87
5.6.330.0000.02014.70
5.6.320.0070.01514.88
5.6.310.0060.01614.67
5.6.300.0000.02114.86
5.6.290.0100.01714.91
5.6.280.0050.04718.01
5.6.270.0070.01514.61
5.6.260.0000.02014.79
5.6.250.0050.05017.83
5.6.240.0080.02917.67
5.6.230.0100.02917.69
5.6.220.0070.02817.71
5.6.210.0060.03317.72
5.6.200.0060.03417.85
5.6.190.0000.03117.99
5.6.180.0110.02717.89
5.6.170.0030.03217.79
5.6.160.0090.02317.95
5.6.150.0060.03417.99
5.6.140.0090.03118.03
5.6.130.0060.02817.90
5.6.120.0030.03217.94
5.6.110.0050.04818.06
5.6.100.0050.05517.87
5.6.90.0070.05017.88
5.6.80.0120.04717.46
5.6.70.0030.03217.46
5.6.60.0080.05117.42
5.6.50.0080.04717.70
5.6.40.0100.03017.37
5.6.30.0080.04317.48
5.6.20.0070.05017.53
5.6.10.0070.03617.53
5.6.00.0050.03217.47
5.5.380.0050.03317.72
5.5.370.0050.03317.72
5.5.360.0050.03017.75
5.5.350.0030.03117.52
5.5.340.0100.02317.86
5.5.330.0070.02117.93
5.5.320.0110.02417.96
5.5.310.0000.03717.82
5.5.300.0050.03117.74
5.5.290.0050.03117.87
5.5.280.0030.04417.70
5.5.270.0030.03617.91
5.5.260.0080.05917.84
5.5.250.0120.04517.66
5.5.240.0090.02817.39
5.5.230.0100.03217.57
5.5.220.0100.04217.44
5.5.210.0070.03517.30
5.5.200.0030.03917.41
5.5.190.0140.02717.49
5.5.180.0080.04817.51
5.5.170.0070.01114.70
5.5.160.0080.03017.31
5.5.150.0030.03817.62
5.5.140.0080.04517.40
5.5.130.0050.05017.46
5.5.120.0060.03417.42
5.5.110.0070.03217.43
5.5.100.0100.04717.42
5.5.90.0080.04217.48
5.5.80.0100.04217.46
5.5.70.0030.04817.48
5.5.60.0050.05117.36
5.5.50.0070.03917.24
5.5.40.0080.05217.42
5.5.30.0030.04417.46
5.5.20.0030.04917.42
5.5.10.0100.04417.33
5.5.00.0100.05117.38
5.4.450.0060.03915.45
5.4.440.0050.03915.54
5.4.430.0080.04915.39
5.4.420.0080.04515.55
5.4.410.0130.04415.49
5.4.400.0050.03015.05
5.4.390.0080.05015.05
5.4.380.0070.03015.27
5.4.370.0210.02315.19
5.4.360.0030.03815.19
5.4.350.0030.03415.10
5.4.340.0030.03415.37
5.4.330.0030.01711.50
5.4.320.0080.05115.39
5.4.310.0100.04215.33
5.4.300.0020.05015.31
5.4.290.0080.04715.02
5.4.280.0070.03715.28
5.4.270.0070.03815.20
5.4.260.0050.04215.31
5.4.250.0070.03215.28
5.4.240.0100.04815.33
5.4.230.0080.04315.16
5.4.220.0050.03515.19
5.4.210.0050.04815.13
5.4.200.0080.04715.29
5.4.190.0100.03815.23
5.4.180.0070.04614.95
5.4.170.0140.04515.16
5.4.160.0110.04615.31
5.4.150.0030.04415.15
5.4.140.0080.04713.91
5.4.130.0010.04713.92
5.4.120.0070.04513.83
5.4.110.0060.03813.95
5.4.100.0050.04913.85
5.4.90.0090.04713.98
5.4.80.0020.05013.95
5.4.70.0030.04313.91
5.4.60.0020.05114.06
5.4.50.0030.05214.02
5.4.40.0070.04214.00
5.4.30.0110.03613.91
5.4.20.0050.04413.96
5.4.10.0120.03913.88
5.4.00.0070.03713.72
5.3.290.0020.05512.88
5.3.280.0010.03912.83
5.3.270.0070.05312.84
5.3.260.0070.04812.97
5.3.250.0020.04812.85
5.3.240.0080.04612.86
5.3.230.0030.04612.87
5.3.220.0000.03912.85
5.3.210.0070.04212.91
5.3.200.0020.03612.86
5.3.190.0020.05312.91
5.3.180.0050.04512.92
5.3.170.0040.03112.94
5.3.160.0020.04412.90
5.3.150.0030.03412.91
5.3.140.0080.03912.90
5.3.130.0050.04612.94
5.3.120.0030.04212.99
5.3.110.0020.05612.83
5.3.100.0020.05512.73
5.3.90.0020.05512.72
5.3.80.0070.04912.63
5.3.70.0050.04412.55
5.3.60.0050.04012.54
5.3.50.0080.04612.61
5.3.40.0050.04412.57
5.3.30.0050.04412.57
5.3.20.0050.05012.40
5.3.10.0030.05112.40
5.3.00.0030.04112.43
5.2.170.0070.06311.64
5.2.160.0070.05711.64
5.2.150.0030.03711.64
5.2.140.0100.05711.64
5.2.130.0100.05711.64
5.2.120.0130.05311.64
5.2.110.0030.05311.64
5.2.100.0100.05011.64
5.2.90.0030.06311.64
5.2.80.0000.04011.64
5.2.70.0070.04311.64
5.2.60.0030.05011.64
5.2.50.0070.05311.64
5.2.40.0070.05711.64
5.2.30.0030.05711.64
5.2.20.0030.03311.64
5.2.10.0000.05011.64
5.2.00.0030.04711.64
5.1.60.0030.02711.64
5.1.50.0030.04711.64
5.1.40.0070.03311.64
5.1.30.0000.06011.64
5.1.20.0100.05011.64
5.1.10.0030.05011.64
5.1.00.0000.03011.64
5.0.50.0100.03011.64
5.0.40.0100.03711.64
5.0.30.0000.06311.64
5.0.20.0070.02011.64
5.0.10.0030.05011.64
5.0.00.0070.06011.64
4.4.90.0000.03711.64
4.4.80.0070.02311.64
4.4.70.0000.03711.64
4.4.60.0030.02311.64
4.4.50.0070.03011.64
4.4.40.0000.03011.64
4.4.30.0000.03011.64
4.4.20.0070.02711.64
4.4.10.0000.03311.64
4.4.00.0000.03011.64
4.3.110.0030.03011.64
4.3.100.0070.02711.64
4.3.90.0000.03711.64
4.3.80.0030.05011.64
4.3.70.0030.03311.64
4.3.60.0000.03711.64
4.3.50.0070.03011.64
4.3.40.0000.04011.64
4.3.30.0000.02711.64
4.3.20.0030.02711.64
4.3.10.0000.02311.64
4.3.00.0000.01711.64

preferences:
37.86 ms | 400 KiB | 5 Q