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(intval($year),intval($month),intval($day)))); // Push DateTime object to the WebService array var_dump(new DateTime('2012-12-30')); die(); // 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))); die(); // 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.120.0070.00715.13
7.3.110.0040.01115.23
7.3.100.0030.01015.23
7.3.90.0030.00715.34
7.3.80.0040.01415.05
7.3.70.0070.01015.23
7.3.60.0090.00615.18
7.3.50.0130.00315.12
7.3.40.0080.00515.11
7.3.30.0060.01015.23
7.3.20.0030.01016.91
7.3.10.0030.01016.85
7.3.00.0070.00916.80
7.2.240.0030.01115.30
7.2.230.0030.01015.28
7.2.220.0110.00715.08
7.2.210.0120.00615.36
7.2.200.0030.01215.19
7.2.190.0030.01415.25
7.2.180.0140.00415.38
7.2.170.0070.00715.34
7.2.160.0040.00715.13
7.2.150.0030.01316.96
7.2.140.0090.00617.10
7.2.130.0060.00816.99
7.2.120.0050.01017.11
7.2.110.0030.01317.03
7.2.100.0060.00716.96
7.2.90.0100.00517.10
7.2.80.0060.00916.93
7.2.70.0040.01317.12
7.2.60.0080.00917.14
7.2.50.0080.01117.04
7.2.40.0050.01217.16
7.2.30.0070.00817.05
7.2.20.0080.00717.15
7.2.10.0080.00317.03
7.2.00.0060.00717.98
7.1.330.0030.01016.02
7.1.320.0040.00715.89
7.1.310.0060.00615.85
7.1.300.0030.00815.94
7.1.290.0100.00315.66
7.1.280.0000.01415.66
7.1.270.0060.00816.08
7.1.260.0000.01115.88
7.1.250.0060.00615.82
7.1.100.0030.00718.01
7.1.70.0030.00617.42
7.1.60.0100.01019.40
7.1.50.0120.01216.97
7.1.00.0070.05322.45
7.0.200.0130.00015.30
7.0.140.0000.07722.09
7.0.70.0030.03321.66
7.0.60.0100.09022.03
7.0.50.0030.04022.48
7.0.40.0000.04320.37
7.0.30.0030.03720.46
7.0.20.0030.05020.24
7.0.10.0000.04320.41
7.0.00.0000.04320.48
5.6.280.0070.07021.02
5.6.220.0000.04020.61
5.6.210.0030.07020.59
5.6.200.0030.05321.07
5.6.190.0030.05021.13
5.6.180.0000.04020.96
5.6.170.0030.04021.16
5.6.160.0070.03721.04
5.6.150.0030.04020.96
5.6.140.0070.03721.00
5.6.130.0000.04321.11
5.6.120.0000.04321.14
5.6.110.0070.04321.00
5.6.100.0000.03721.15
5.6.90.0070.07021.03
5.6.80.0070.05320.35
5.6.70.0100.07320.43
5.6.60.0070.07720.36
5.6.50.0070.05020.52
5.6.40.0030.08320.46
5.6.30.0000.05020.43
5.6.20.0130.07320.46
5.6.10.0030.08020.55
5.6.00.0000.08320.33
5.5.360.0000.04320.36
5.5.350.0030.04020.34
5.5.340.0030.04020.86
5.5.330.0030.04020.90
5.5.320.0030.05720.91
5.5.310.0030.03720.80
5.5.300.0000.04320.89
5.5.290.0030.04320.95
5.5.280.0030.04020.93
5.5.270.0030.04020.94
5.5.260.0030.07020.93
5.5.250.0000.04020.61
5.5.240.0030.08720.27
5.5.230.0130.06720.30
5.5.220.0030.08020.32
5.5.210.0070.07320.27
5.5.200.0100.07320.23
5.5.190.0070.08020.21
5.5.180.0000.08720.09
5.5.160.0100.07020.02
5.5.150.0070.05720.19
5.5.140.0130.07320.20
5.5.130.0070.08020.27
5.5.120.0000.07020.17
5.5.110.0000.08020.28
5.5.100.0000.06319.98
5.5.90.0070.03720.19
5.5.80.0070.08020.09
5.5.70.0130.06720.08
5.5.60.0070.05720.18
5.5.50.0030.06020.12
5.5.40.0100.07320.11
5.5.30.0130.05720.16
5.5.20.0000.06720.16
5.5.10.0130.07320.16
5.5.00.0000.08320.04
5.4.450.0030.03719.44
5.4.440.0000.05019.47
5.4.430.0070.05019.34
5.4.420.0000.07719.36
5.4.410.0100.07719.35
5.4.400.0030.03718.93
5.4.390.0000.08019.13
5.4.380.0070.03719.13
5.4.370.0000.06719.19
5.4.360.0070.05019.25
5.4.350.0030.05018.92
5.4.340.0070.07319.18
5.4.320.0000.08319.04
5.4.310.0070.08019.24
5.4.300.0030.07319.10
5.4.290.0000.05019.04
5.4.280.0030.04019.06
5.4.270.0000.04018.86
5.4.260.0070.05719.15
5.4.250.0070.06719.24
5.4.240.0000.05719.24
5.4.230.0100.07019.14
5.4.220.0030.04019.21
5.4.210.0000.06718.88
5.4.200.0100.06718.91
5.4.190.0030.05719.21
5.4.180.0000.08018.85
5.4.170.0030.05319.13
5.4.160.0070.08019.09
5.4.150.0070.04719.23
5.4.140.0000.07316.32
5.4.130.0030.06716.49
5.4.120.0030.07316.25
5.4.110.0030.06316.54
5.4.100.0030.04716.43
5.4.90.0030.07316.51
5.4.80.0070.06016.37
5.4.70.0070.07016.52
5.4.60.0070.04316.53
5.4.50.0030.03716.55
5.4.40.0070.06716.55
5.4.30.0000.08716.51
5.4.20.0000.06316.50
5.4.10.0070.07316.54
5.4.00.0070.07015.96
5.3.290.0070.08014.66
5.3.280.0030.07314.68
5.3.270.0070.08014.78
5.3.260.0070.08014.61
5.3.250.0030.07714.81
5.3.240.0070.07314.70
5.3.230.0070.07714.79
5.3.220.0100.06714.69
5.3.210.0070.09014.69
5.3.200.0070.06714.64
5.3.190.0070.08014.56
5.3.180.0030.07314.75
5.3.170.0000.05714.65
5.3.160.0030.06714.60
5.3.150.0030.07714.62
5.3.140.0030.07314.64
5.3.130.0030.07314.61
5.3.120.0070.07314.73
5.3.110.0000.04714.54
5.3.100.0030.05014.03
5.3.90.0030.07714.19
5.3.80.0100.06014.13
5.3.70.0000.07714.11
5.3.60.0070.06714.07
5.3.50.0000.07714.11
5.3.40.0030.04014.04
5.3.30.0070.03714.00
5.3.20.0000.08013.68
5.3.10.0100.03013.86
5.3.00.0000.04313.82
5.2.170.0030.06012.32
5.2.160.0030.05712.32
5.2.150.0030.06012.32
5.2.140.0030.04312.32
5.2.130.0000.05012.32
5.2.120.0030.03712.32
5.2.110.0000.03312.32
5.2.100.0100.04012.32
5.2.90.0000.06012.32
5.2.80.0100.05712.32
5.2.70.0030.05712.32
5.2.60.0030.05712.32
5.2.50.0030.06712.32
5.2.40.0000.06012.32
5.2.30.0030.06312.32
5.2.20.0070.05712.32
5.2.10.0030.06012.32
5.2.00.0030.05312.32
5.1.60.0030.05012.32
5.1.50.0000.05312.32
5.1.40.0030.04012.32
5.1.30.0000.06012.32
5.1.20.0030.05312.32
5.1.10.0100.05012.32
5.1.00.0000.04712.32
5.0.50.0030.04312.32
5.0.40.0000.03012.32
5.0.30.0070.04012.32
5.0.20.0000.02712.32
5.0.10.0000.05312.32
5.0.00.0030.04712.32
4.4.90.0030.03312.32
4.4.80.0030.03312.32
4.4.70.0030.03012.32
4.4.60.0030.02312.32
4.4.50.0030.03312.32
4.4.40.0000.05312.32
4.4.30.0000.02012.32
4.4.20.0030.02312.32
4.4.10.0030.03312.32
4.4.00.0000.03712.32
4.3.110.0000.04012.32
4.3.100.0030.02712.32
4.3.90.0000.03712.32
4.3.80.0030.03012.32
4.3.70.0000.03712.32
4.3.60.0000.02712.32
4.3.50.0000.02012.32
4.3.40.0000.05312.32
4.3.30.0030.02312.32
4.3.20.0000.03712.32
4.3.10.0070.02712.32
4.3.00.0000.03312.32

preferences:
36.38 ms | 401 KiB | 5 Q