3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Set demo vars $year = '2012'; $months = array('10','11','12'); $days = array('01','02','03','04','06','07','08','09','11','12','13','14','16','17','18','19','21','22','23','24','26','27','28','30'); $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 var_dump($dateIni); var_dump($dateEnd); die(); // 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'); } var_dump($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.3.00.0090.00316.87
7.2.130.0080.00817.00
7.2.120.0080.00317.16
7.2.110.0120.00316.88
7.2.100.0110.00017.15
7.2.90.0030.01217.15
7.2.80.0080.00417.11
7.2.70.0000.01216.89
7.2.60.0060.00617.08
7.2.50.0000.01417.04
7.2.40.0050.00517.28
7.2.30.0070.00717.18
7.2.20.0030.01316.74
7.2.10.0060.00616.99
7.2.00.0000.01217.19
7.1.250.0000.01115.98
7.1.240.0030.01015.65
7.1.230.0060.00615.68
7.1.220.0040.00715.83
7.1.210.0120.00016.10
7.1.200.0030.00815.80
7.1.190.0060.01215.86
7.1.180.0110.00816.07
7.1.170.0060.00316.11
7.1.160.0000.00715.64
7.1.150.0040.01115.71
7.1.140.0030.00615.91
7.1.130.0000.01515.89
7.1.120.0090.00316.03
7.1.110.0100.00716.08
7.1.100.0000.00815.73
7.1.90.0080.00315.83
7.1.80.0100.00315.91
7.1.70.0000.01016.72
7.1.60.0020.01817.51
7.1.50.0060.00716.69
7.1.40.0030.01015.88
7.1.30.0100.00315.79
7.1.20.0100.00715.73
7.1.10.0060.00616.02
7.1.00.0070.04319.24
7.0.330.0000.01015.48
7.0.320.0000.01415.60
7.0.310.0040.00715.57
7.0.300.0030.00715.51
7.0.290.0030.00715.20
7.0.280.0030.00715.60
7.0.270.0060.00615.48
7.0.260.0000.00815.73
7.0.250.0040.01115.47
7.0.240.0060.00615.58
7.0.230.0070.00715.59
7.0.220.0030.00715.41
7.0.210.0000.00815.39
7.0.200.0050.00716.29
7.0.190.0040.00715.35
7.0.180.0070.00315.69
7.0.170.0050.01015.70
7.0.160.0090.00915.48
7.0.150.0090.00515.35
7.0.140.0070.04318.74
7.0.130.0090.00915.46
7.0.120.0210.00015.28
7.0.110.0130.00815.61
7.0.100.0080.04217.63
7.0.90.0090.04017.67
7.0.80.0070.04917.85
7.0.70.0210.04817.54
7.0.60.0200.05117.90
7.0.50.0200.03318.03
7.0.40.0070.04716.77
7.0.30.0130.04016.82
7.0.20.0050.03016.93
7.0.10.0050.03816.90
7.0.00.0060.04116.88
5.6.380.0030.00514.42
5.6.370.0000.01214.79
5.6.360.0060.00314.30
5.6.350.0090.00314.64
5.6.340.0040.00414.82
5.6.330.0090.00614.62
5.6.320.0030.00914.32
5.6.310.0030.00914.65
5.6.300.0030.01014.47
5.6.290.0000.01414.04
5.6.280.0030.01014.84
5.6.270.0090.00614.31
5.6.260.0030.01014.49
5.6.250.0050.03517.42
5.6.240.0070.04417.57
5.6.230.0020.04717.59
5.6.220.0070.04217.60
5.6.210.0100.04017.51
5.6.200.0120.04117.81
5.6.190.0080.04017.78
5.6.180.0070.04517.90
5.6.170.0050.03018.00
5.6.160.0110.04817.71
5.6.150.0080.02817.81
5.6.140.0030.04517.73
5.6.130.0090.03017.82
5.6.120.0100.03517.72
5.6.110.0070.03717.73
5.6.100.0050.04017.63
5.6.90.0100.04617.63
5.6.80.0160.02417.45
5.6.70.0070.02517.42
5.6.60.0000.03117.22
5.6.50.0150.01717.54
5.6.40.0030.04017.46
5.6.30.0050.03817.61
5.6.20.0100.04017.35
5.6.10.0080.04117.51
5.6.00.0110.04117.37
5.5.380.0100.03815.77
5.5.370.0030.03115.95
5.5.360.0070.04615.92
5.5.350.0080.04015.82
5.5.340.0070.03416.18
5.5.330.0080.03816.13
5.5.320.0050.04316.12
5.5.310.0060.02616.25
5.5.300.0050.03016.14
5.5.290.0080.04016.12
5.5.280.0030.04716.03
5.5.270.0120.04016.12
5.5.260.0060.04516.18
5.5.250.0050.03015.83
5.5.240.0090.02215.83
5.5.230.0050.03115.84
5.5.220.0100.04015.86
5.5.210.0090.02215.78
5.5.200.0100.02315.79
5.5.190.0050.04215.93
5.5.180.0100.03715.71
5.5.170.0030.00911.18
5.5.160.0060.04415.67
5.5.150.0090.02515.72
5.5.140.0080.03815.80
5.5.130.0070.04015.83
5.5.120.0050.04315.69
5.5.110.0100.03715.59
5.5.100.0100.04015.66
5.5.90.0070.03815.77
5.5.80.0080.04315.57
5.5.70.0020.04215.65
5.5.60.0110.02615.64
5.5.50.0060.04015.67
5.5.40.0120.02215.83
5.5.30.0080.02915.70
5.5.20.0070.03915.76
5.5.10.0080.03715.81
5.5.00.0070.04215.71
5.4.450.0000.04715.55
5.4.440.0070.05315.21
5.4.430.0060.02615.30
5.4.420.0050.03515.37
5.4.410.0070.04315.32
5.4.400.0100.04015.37
5.4.390.0100.03915.19
5.4.380.0050.03715.18
5.4.370.0050.03515.11
5.4.360.0090.03815.27
5.4.350.0040.04415.06
5.4.340.0050.04515.16
5.4.330.0030.00611.20
5.4.320.0070.04215.11
5.4.310.0050.03315.31
5.4.300.0070.04015.25
5.4.290.0020.04315.21
5.4.280.0030.03815.17
5.4.270.0080.03415.18
5.4.260.0030.04015.04
5.4.250.0070.04115.14
5.4.240.0030.04615.23
5.4.230.0100.03815.16
5.4.220.0130.03615.05
5.4.210.0050.04415.28
5.4.200.0100.03615.24
5.4.190.0020.03015.12
5.4.180.0060.03015.21
5.4.170.0090.03515.17
5.4.160.0050.02315.14
5.4.150.0050.04015.10
5.4.140.0060.03113.73
5.4.130.0040.02613.80
5.4.120.0040.03013.80
5.4.110.0030.04313.79
5.4.100.0090.01913.79
5.4.90.0080.02213.84
5.4.80.0080.03513.84
5.4.70.0050.03813.86
5.4.60.0100.02013.90
5.4.50.0040.02613.87
5.4.40.0120.02013.81
5.4.30.0070.02913.78
5.4.20.0100.03613.84
5.4.10.0000.03913.86
5.4.00.0030.02613.60
5.3.290.0090.02512.98
5.3.280.0030.04512.98
5.3.270.0030.04412.98
5.3.260.0070.03512.91
5.3.250.0050.03212.89
5.3.240.0050.03512.95
5.3.230.0060.04312.96
5.3.220.0050.02512.89
5.3.210.0050.04012.87
5.3.200.0050.03212.96
5.3.190.0070.02512.96
5.3.180.0030.03012.93
5.3.170.0080.04012.95
5.3.160.0110.02512.89
5.3.150.0080.04112.92
5.3.140.0030.04312.95
5.3.130.0040.03812.94
5.3.120.0040.02812.91
5.3.110.0040.02612.89
5.3.100.0030.04112.60
5.3.90.0030.03712.66
5.3.80.0030.04212.64
5.3.70.0030.03812.58
5.3.60.0050.02712.62
5.3.50.0050.02612.60
5.3.40.0030.03912.61
5.3.30.0100.03812.65
5.3.20.0090.03612.49
5.3.10.0060.04412.44
5.3.00.0090.03312.51
5.2.170.0070.03211.09
5.2.160.0100.03011.19
5.2.150.0040.03211.08
5.2.140.0070.02011.16
5.2.130.0060.01911.07
5.2.120.0110.01211.14
5.2.110.0110.02311.15
5.2.100.0040.01911.07
5.2.90.0040.01911.07
5.2.80.0090.03111.13
5.2.70.0070.02711.15
5.2.60.0020.03911.07
5.2.50.0080.02311.07
5.2.40.0070.03311.07
5.2.30.0110.02711.07
5.2.20.0020.02511.09
5.2.10.0060.01811.07
5.2.00.0100.03211.07
5.1.60.0080.01911.07
5.1.50.0030.02511.07
5.1.40.0090.02311.07
5.1.30.0040.02011.07
5.1.20.0030.01611.07
5.1.10.0030.01311.07
5.1.00.0030.02111.07
5.0.50.0020.02311.07
5.0.40.0020.01711.07
5.0.30.0020.02011.07
5.0.20.0060.01211.07
5.0.10.0050.01011.07
5.0.00.0000.03111.07
4.4.90.0060.01711.07
4.4.80.0030.01811.07
4.4.70.0030.02011.07
4.4.60.0050.01211.07
4.4.50.0010.01111.07
4.4.40.0010.02811.07
4.4.30.0030.01011.07
4.4.20.0050.01311.07
4.4.10.0000.02111.07
4.4.00.0010.01911.07
4.3.110.0020.01211.07
4.3.100.0030.01511.07
4.3.90.0030.01011.07
4.3.80.0000.02711.07
4.3.70.0020.01011.07
4.3.60.0000.02011.07
4.3.50.0000.01911.07
4.3.40.0020.02911.07
4.3.30.0030.01511.07
4.3.20.0020.01311.07
4.3.10.0040.01711.07
4.3.00.0020.01911.07

preferences:
33.72 ms | 401 KiB | 5 Q