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 // 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))); 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.00415.32
7.3.120.0100.01015.23
7.3.110.0000.01615.23
7.3.100.0180.00415.23
7.3.90.0060.00915.22
7.3.80.0130.00315.02
7.3.70.0070.00714.95
7.3.60.0070.00315.03
7.3.50.0080.00815.16
7.3.40.0040.01115.09
7.3.30.0000.01015.00
7.3.20.0120.00316.86
7.3.10.0040.00916.88
7.3.00.0070.00316.82
7.2.250.0110.01115.14
7.2.240.0070.01415.36
7.2.230.0060.00915.22
7.2.220.0060.00915.36
7.2.210.0070.00715.15
7.2.200.0030.01115.36
7.2.190.0000.01115.22
7.2.180.0070.01015.43
7.2.170.0100.00715.30
7.2.160.0140.00415.39
7.2.150.0100.00717.13
7.2.140.0080.00816.92
7.2.130.0070.00717.20
7.2.120.0060.01217.20
7.2.110.0120.00617.28
7.2.100.0060.00616.78
7.2.90.0030.01417.12
7.2.80.0130.00716.87
7.2.70.0100.00616.98
7.2.60.0080.00417.32
7.2.50.0080.00817.21
7.2.40.0070.01017.14
7.2.30.0000.01417.32
7.2.20.0000.01217.12
7.2.10.0090.00616.96
7.2.00.0070.01317.21
7.1.330.0030.01316.07
7.1.320.0090.00615.79
7.1.310.0060.00915.91
7.1.300.0060.00615.96
7.1.290.0000.01116.16
7.1.280.0030.01315.84
7.1.270.0060.00915.76
7.1.260.0070.00716.15
7.1.250.0060.00916.10
7.1.240.0070.00716.07
7.1.230.0070.00415.82
7.1.220.0050.00516.05
7.1.210.0040.01415.92
7.1.200.0030.01316.18
7.1.190.0040.01216.14
7.1.180.0000.01716.12
7.1.170.0120.00616.11
7.1.160.0090.00316.02
7.1.150.0040.01116.07
7.1.140.0060.00616.20
7.1.130.0070.00315.96
7.1.120.0030.01315.93
7.1.110.0100.00716.11
7.1.100.0000.01216.02
7.1.90.0040.01215.95
7.1.80.0070.01015.76
7.1.70.0030.01116.40
7.1.60.0100.00817.58
7.1.50.0050.01316.72
7.1.40.0090.00616.03
7.1.30.0040.01116.14
7.1.20.0060.00916.16
7.1.10.0030.00916.14
7.1.00.0030.04519.21
7.0.330.0070.01015.53
7.0.320.0030.01015.59
7.0.310.0060.00915.72
7.0.300.0130.00315.33
7.0.290.0070.00715.72
7.0.280.0000.01715.58
7.0.270.0120.00315.52
7.0.260.0120.00615.64
7.0.250.0070.00715.76
7.0.240.0070.00715.61
7.0.230.0090.00615.70
7.0.220.0090.00615.71
7.0.210.0090.00915.72
7.0.200.0030.00716.32
7.0.190.0070.01015.54
7.0.180.0030.01015.55
7.0.170.0100.00315.66
7.0.160.0030.01315.66
7.0.150.0100.00315.63
7.0.140.0080.04018.87
7.0.130.0030.01015.75
7.0.120.0050.00515.52
7.0.110.0070.00315.73
7.0.100.0150.03517.81
7.0.90.0060.04617.84
7.0.80.0070.04317.86
7.0.70.0080.03817.65
7.0.60.0070.04817.79
7.0.50.0110.03617.95
7.0.40.0080.04316.83
7.0.30.0020.04316.76
7.0.20.0100.04716.75
7.0.10.0050.04716.89
7.0.00.0030.05016.70
5.6.400.0110.00414.49
5.6.390.0030.01314.77
5.6.380.0000.01014.95
5.6.370.0070.01014.74
5.6.360.0000.01514.35
5.6.350.0150.00314.56
5.6.340.0030.01414.85
5.6.330.0090.00614.70
5.6.320.0070.01014.95
5.6.310.0060.00614.83
5.6.300.0070.01114.49
5.6.290.0120.00614.66
5.6.280.0030.04218.01
5.6.270.0100.00714.68
5.6.260.0100.00314.87
5.6.250.0070.04517.74
5.6.240.0030.05017.78
5.6.230.0080.03917.74
5.6.220.0100.04017.67
5.6.210.0080.04817.62
5.6.200.0120.03817.93
5.6.190.0100.03317.87
5.6.180.0020.04817.87
5.6.170.0030.03117.90
5.6.160.0080.02617.99
5.6.150.0060.04518.07
5.6.140.0030.04717.99
5.6.130.0080.04418.04
5.6.120.0050.04717.90
5.6.110.0050.02718.08
5.6.100.0060.02717.98
5.6.90.0060.04618.10
5.6.80.0050.04517.63
5.6.70.0050.03717.75
5.6.60.0080.03817.52
5.6.50.0130.04017.64
5.6.40.0120.03917.53
5.6.30.0120.03717.60
5.6.20.0120.03217.67
5.6.10.0060.04617.64
5.6.00.0090.04017.55
5.5.380.0070.04717.67
5.5.370.0130.03817.60
5.5.360.0100.04217.45
5.5.350.0080.04217.50
5.5.340.0050.03017.80
5.5.330.0100.03817.73
5.5.320.0080.04617.82
5.5.310.0070.04317.84
5.5.300.0100.04317.66
5.5.290.0050.04517.78
5.5.280.0050.04517.87
5.5.270.0020.05017.88
5.5.260.0030.04717.77
5.5.250.0120.03717.67
5.5.240.0100.04017.42
5.5.230.0110.04017.37
5.5.220.0030.04717.48
5.5.210.0050.03017.47
5.5.200.0030.02617.46
5.5.190.0110.04317.56
5.5.180.0080.04417.44
5.5.170.0090.00614.42
5.5.160.0080.03817.45
5.5.150.0080.02617.54
5.5.140.0080.04317.54
5.5.130.0070.02817.44
5.5.120.0050.03017.29
5.5.110.0100.04317.38
5.5.100.0080.03017.19
5.5.90.0070.04417.36
5.5.80.0120.02717.55
5.5.70.0070.04417.41
5.5.60.0100.03917.48
5.5.50.0100.03217.24
5.5.40.0050.02917.37
5.5.30.0090.04317.32
5.5.20.0080.04817.25
5.5.10.0070.04217.45
5.5.00.0050.05017.29
5.4.450.0050.04515.34
5.4.440.0030.04715.64
5.4.430.0100.02815.48
5.4.420.0050.04515.37
5.4.410.0030.02515.49
5.4.400.0070.04315.26
5.4.390.0030.03815.25
5.4.380.0060.02515.25
5.4.370.0090.04115.14
5.4.360.0110.03615.22
5.4.350.0070.04015.21
5.4.340.0050.03315.23
5.4.330.0120.00611.38
5.4.320.0070.02015.16
5.4.310.0050.04015.16
5.4.300.0040.04315.08
5.4.290.0030.04215.08
5.4.280.0070.04315.28
5.4.270.0080.03815.03
5.4.260.0080.04115.29
5.4.250.0070.03815.31
5.4.240.0020.04315.32
5.4.230.0050.04215.22
5.4.220.0100.02315.21
5.4.210.0020.04615.18
5.4.200.0140.03315.19
5.4.190.0030.04515.29
5.4.180.0060.04015.22
5.4.170.0060.04015.21
5.4.160.0080.04015.22
5.4.150.0050.03815.21
5.4.140.0080.01813.80
5.4.130.0030.02713.96
5.4.120.0020.03013.98
5.4.110.0020.02514.04
5.4.100.0020.02613.89
5.4.90.0070.02013.89
5.4.80.0030.02513.86
5.4.70.0030.02114.03
5.4.60.0030.02113.93
5.4.50.0050.02613.81
5.4.40.0050.03613.81
5.4.30.0020.02713.81
5.4.20.0050.02113.82
5.4.10.0090.01913.97
5.4.00.0050.02213.67
5.3.290.0050.04512.92
5.3.280.0020.04612.95
5.3.270.0050.03012.89
5.3.260.0020.04812.87
5.3.250.0060.04312.91
5.3.240.0050.02312.88
5.3.230.0060.02312.86
5.3.220.0030.02812.81
5.3.210.0030.02512.90
5.3.200.0030.02212.89
5.3.190.0070.02412.91
5.3.180.0100.01812.89
5.3.170.0070.01712.92
5.3.160.0030.04012.91
5.3.150.0020.02612.92
5.3.140.0090.03212.83
5.3.130.0050.02212.96
5.3.120.0040.02112.89
5.3.110.0090.01912.89
5.3.100.0050.02012.62
5.3.90.0060.01912.58
5.3.80.0030.02112.53
5.3.70.0050.02012.62
5.3.60.0030.02012.52
5.3.50.0060.02012.50
5.3.40.0020.02612.56
5.3.30.0090.01712.60
5.3.20.0050.01912.37
5.3.10.0040.02012.39
5.3.00.0030.02312.39
5.2.170.0000.03011.14
5.2.160.0030.02711.11
5.2.150.0000.03011.21
5.2.140.0030.02711.21
5.2.130.0000.03010.96
5.2.120.0000.05011.18
5.2.110.0000.02710.95
5.2.100.0030.02711.16
5.2.90.0030.03011.09
5.2.80.0000.03311.12
5.2.70.0000.03311.13
5.2.60.0000.03011.04
5.2.50.0030.02710.88
5.2.40.0030.03010.99
5.2.30.0000.03310.89
5.2.20.0100.02310.76
5.2.10.0000.03010.77
5.2.00.0000.03010.75
5.1.60.0030.02310.04
5.1.50.0000.02710.00
5.1.40.0070.02010.03
5.1.30.0070.03010.41
5.1.20.0000.02310.40
5.1.10.0000.02710.04
5.1.00.0000.02710.09
5.0.50.0000.0209.93
5.0.40.0030.0179.93
5.0.30.0000.0379.93
5.0.20.0030.0179.93
5.0.10.0030.0179.93
5.0.00.0000.0279.93
4.4.90.0030.0139.93
4.4.80.0000.0209.93
4.4.70.0030.0139.93
4.4.60.0000.0179.93
4.4.50.0030.0139.93
4.4.40.0000.0239.93
4.4.30.0030.0139.93
4.4.20.0030.0139.93
4.4.10.0030.0139.93
4.4.00.0000.0279.93
4.3.110.0000.0179.93
4.3.100.0030.0109.93
4.3.90.0000.0179.93
4.3.80.0000.0239.93
4.3.70.0030.0139.93
4.3.60.0030.0139.93
4.3.50.0030.0179.93
4.3.40.0030.0509.93
4.3.30.0000.0239.93
4.3.20.0030.0339.93
4.3.10.0070.0279.93
4.3.00.0000.0309.93

preferences:
42.71 ms | 400 KiB | 5 Q