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($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($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.4.00.0110.01415.48
7.3.120.0030.02015.31
7.3.110.0150.00815.25
7.3.100.0000.02115.02
7.3.90.0110.00714.95
7.3.80.0130.01015.08
7.3.70.0070.01715.05
7.3.60.0070.01015.21
7.3.50.0070.01515.18
7.3.40.0060.01214.93
7.3.30.0140.00314.76
7.3.20.0060.01016.63
7.3.10.0090.00916.64
7.3.00.0100.00916.82
7.2.250.0060.01615.33
7.2.240.0100.01415.26
7.2.230.0100.01015.53
7.2.220.0100.01715.46
7.2.210.0140.00315.26
7.2.200.0080.01115.45
7.2.190.0100.00715.32
7.2.180.0130.00615.27
7.2.170.0060.01615.50
7.2.130.0240.00717.10
7.2.120.0190.01116.73
7.2.110.0180.01316.68
7.2.100.0190.00916.55
7.2.90.0070.01916.80
7.2.80.0180.00917.27
7.2.70.0130.02116.95
7.2.60.0110.01917.32
7.2.50.0070.02117.03
7.2.40.0130.01317.07
7.2.30.0170.00716.90
7.2.20.0220.00416.61
7.2.10.0120.01217.21
7.2.00.0120.00916.86
7.1.330.0030.01715.87
7.1.320.0070.01016.11
7.1.310.0030.01916.06
7.1.300.0040.01515.85
7.1.290.0100.01315.99
7.1.280.0130.01016.05
7.1.270.0090.00915.70
7.1.260.0100.01016.17
7.1.250.0250.00416.04
7.1.70.0090.00317.21
7.1.60.0160.01319.82
7.1.50.0100.01617.25
7.1.00.0030.08022.34
7.0.200.0090.00316.66
7.0.140.0170.06322.04
7.0.110.0130.07720.13
7.0.100.0100.07020.05
7.0.90.0000.08320.14
7.0.80.0100.08320.00
7.0.70.0070.04020.11
7.0.60.0070.03720.05
7.0.50.0100.03720.12
7.0.40.0070.04019.59
7.0.30.0030.04319.64
7.0.20.0030.04319.87
7.0.10.0030.03319.82
7.0.00.0100.03719.86
5.6.280.0030.07321.00
5.6.260.0100.05320.74
5.6.250.0070.07020.78
5.6.240.0170.08020.59
5.6.230.0030.04320.78
5.6.220.0070.07320.74
5.6.210.0130.04320.51
5.6.200.0030.04020.66
5.6.190.0030.04320.74
5.6.180.0070.04020.75
5.6.170.0070.03720.71
5.6.160.0030.04020.77
5.6.150.0070.04020.80
5.6.140.0130.04320.74
5.6.130.0070.04020.68
5.6.120.0100.03320.68
5.6.110.0200.07320.64
5.6.100.0070.03720.68
5.6.90.0100.03720.64
5.6.80.0070.03720.33
5.6.70.0100.03320.08
5.6.60.0070.04720.02
5.6.50.0000.04720.08
5.6.40.0030.03720.30
5.6.30.0030.04320.09
5.6.20.0000.04320.15
5.6.10.0070.03320.06
5.6.00.0070.03320.00
5.5.380.0100.06317.61
5.5.370.0070.07717.74
5.5.360.0130.07317.73
5.5.350.0070.07317.34
5.5.340.0070.03718.31
5.5.330.0070.03717.91
5.5.320.0030.04718.17
5.5.310.0070.04018.13
5.5.300.0070.04018.09
5.5.290.0000.04718.13
5.5.280.0130.08018.00
5.5.270.0170.05017.89
5.5.260.0070.06718.13
5.5.250.0000.04317.90
5.5.240.0030.03717.48
5.5.230.0100.03317.56
5.5.220.0070.03017.32
5.5.210.0070.03717.52
5.5.200.0100.03317.50
5.5.190.0030.04017.32
5.5.180.0100.05017.30
5.5.160.0000.04317.37
5.5.150.0030.04017.38
5.5.140.0000.03717.61
5.5.130.0070.03717.51
5.5.120.0070.03017.38
5.5.110.0070.03717.25
5.5.100.0130.03017.36
5.5.90.0030.03717.22
5.5.80.0070.04017.38
5.5.70.0100.03317.26
5.5.60.0070.03717.23
5.5.50.0000.03717.23
5.5.40.0100.03317.55
5.5.30.0030.03717.24
5.5.20.0170.07317.51
5.5.10.0000.04017.22
5.5.00.0070.08017.41
5.4.450.0070.03719.38
5.4.440.0070.03719.71
5.4.430.0100.05319.38
5.4.420.0070.06319.53
5.4.410.0000.04319.54
5.4.400.0000.04319.05
5.4.390.0070.03719.29
5.4.380.0000.04319.05
5.4.370.0030.04319.27
5.4.360.0030.04319.20
5.4.350.0000.04319.04
5.4.340.0130.03719.28
5.4.320.0070.03719.07
5.4.310.0100.03319.05
5.4.300.0000.04319.01
5.4.290.0030.04019.37
5.4.280.0030.03319.07
5.4.270.0170.02719.09
5.4.260.0070.03019.03
5.4.250.0070.03719.06
5.4.240.0030.04019.02
5.4.230.0030.04019.04
5.4.220.0070.04319.27
5.4.210.0100.03319.02
5.4.200.0030.04319.03
5.4.190.0130.06319.19
5.4.180.0070.06319.27
5.4.170.0130.03319.19
5.4.160.0130.07319.36
5.4.150.0030.07019.16
5.4.140.0130.07016.69
5.4.130.0030.07016.63
5.4.120.0070.07316.63
5.4.110.0070.04316.66
5.4.100.0130.06716.65
5.4.90.0000.04316.59
5.4.80.0070.07316.39
5.4.70.0030.06016.65
5.4.60.0070.05716.54
5.4.50.0230.06316.34
5.4.40.0030.07316.57
5.4.30.0030.04316.63
5.4.20.0170.05016.32
5.4.10.0100.07016.71
5.4.00.0070.04716.01
5.3.290.0030.04014.93
5.3.280.0130.03014.78
5.3.270.0000.07014.79
5.3.260.0100.03314.92
5.3.250.0030.03714.79
5.3.240.0030.04014.91
5.3.230.0230.03014.75
5.3.220.0100.04014.89
5.3.210.0030.05314.69
5.3.200.0170.06714.62
5.3.190.0130.06314.88
5.3.180.0130.04314.86
5.3.170.0030.05014.75
5.3.160.0000.05014.97
5.3.150.0070.04714.82
5.3.140.0200.06314.86
5.3.130.0100.04014.75
5.3.120.0100.06014.70
5.3.110.0070.04314.72
5.3.100.0330.05714.43
5.3.90.0130.06314.42
5.3.80.0100.07314.20
5.3.70.0100.04714.20
5.3.60.0030.07314.27
5.3.50.0070.06314.16
5.3.40.0030.05714.11
5.3.30.0100.05714.11
5.3.20.0130.06713.99
5.3.10.0000.07313.83
5.3.00.0030.05314.04
5.2.170.0070.03012.39
5.2.160.0000.03312.39
5.2.150.0100.05012.39
5.2.140.0030.06012.39
5.2.130.0070.05312.39
5.2.120.0030.03312.39
5.2.110.0100.05312.39
5.2.100.0030.05012.39
5.2.90.0000.04012.39
5.2.80.0070.02712.39
5.2.70.0000.03312.39
5.2.60.0070.04312.39
5.2.50.0000.04312.39
5.2.40.0130.05312.39
5.2.30.0030.06012.39
5.2.20.0030.03312.39
5.2.10.0000.05312.39
5.2.00.0070.05312.39
5.1.60.0070.04712.39
5.1.50.0000.05712.39
5.1.40.0030.02712.39
5.1.30.0070.04012.39
5.1.20.0030.04312.39
5.1.10.0130.02012.39
5.1.00.0070.04012.39
5.0.50.0000.03712.39
5.0.40.0070.01712.39
5.0.30.0030.04312.39
5.0.20.0030.03312.39
5.0.10.0030.03312.39
5.0.00.0070.06012.39
4.4.90.0000.02312.39
4.4.80.0030.02712.39
4.4.70.0000.02712.39
4.4.60.0000.02712.39
4.4.50.0000.03012.39
4.4.40.0070.03712.39
4.4.30.0070.03012.39
4.4.20.0000.02012.39
4.4.10.0000.01712.39
4.4.00.0070.04712.39
4.3.110.0030.03012.39
4.3.100.0000.03012.39
4.3.90.0070.02712.39
4.3.80.0070.04712.39
4.3.70.0070.02312.39
4.3.60.0070.03012.39
4.3.50.0030.02312.39
4.3.40.0000.03012.39
4.3.30.0000.03312.39
4.3.20.0000.03012.39
4.3.10.0000.01712.39
4.3.00.0000.03712.39

preferences:
35.65 ms | 400 KiB | 5 Q