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,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30); foreach($months AS $month) foreach($days AS $day) if((int)$year && (int)$month && (int)$day && rand(0,100)>15) // Randomize dates, withdraw 15% of them $datesWS[] = new DateTime(implode('-',array($year,$month,$day))); // Push DateTime object to the WebService array // 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' ))); // Get excluded dates $excludeDates = array_udiff($datesRange, $datesWS, function ($a, $b) { return $a == $b ? 0 : 1; }); foreach($datesRange AS $date) { echo $date->format('d/m/Y'); echo in_array($date->format('d/m/Y'),array_values(array_map(function($obj){ return $obj->format('d/m/Y'); },$datesWS)))? " existe " : " exclusión "; } // 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)
5.6.280.0130.07721.17
5.6.250.0030.04020.80
5.6.240.0100.05320.75
5.6.230.0130.07020.77
5.6.220.0300.06320.73
5.6.210.0070.09020.70
5.6.200.0070.07320.98
5.6.190.0100.08021.08
5.6.180.0000.05021.13
5.6.170.0000.08021.19
5.6.160.0000.06721.11
5.6.150.0170.07021.11
5.6.140.0130.08021.11
5.6.130.0030.05021.16
5.6.120.0170.09021.23
5.6.110.0100.04721.08
5.6.100.0030.08721.18
5.6.90.0130.08021.18
5.6.80.0030.09720.68
5.6.70.0130.07320.48
5.6.60.0130.05020.48
5.6.50.0170.08720.54
5.6.40.0100.08320.45
5.6.30.0100.08020.40
5.6.20.0130.08720.46
5.6.10.0030.04720.50
5.6.00.0130.05320.51
5.5.380.0070.03720.54
5.5.370.0070.04020.65
5.5.360.0070.06720.43
5.5.350.0200.04020.52
5.5.340.0130.04020.86
5.5.330.0130.08320.97
5.5.320.0070.05720.82
5.5.310.0100.04020.97
5.5.300.0200.08020.86
5.5.290.0070.04320.95
5.5.280.0170.08020.84
5.5.270.0170.09020.86
5.5.260.0170.09321.00
5.5.250.0200.07320.66
5.5.240.0100.07720.21
5.5.230.0170.08320.34
5.5.220.0070.08020.38
5.5.210.0100.08020.27
5.5.200.0070.08320.30
5.5.190.0130.09020.27
5.5.180.0130.10020.33
5.5.160.0230.07020.36
5.5.150.0130.05320.30
5.5.140.0130.08020.20
5.5.130.0030.09320.36
5.5.120.0130.03320.36
5.5.110.0070.08320.35
5.5.100.0070.09720.20
5.5.90.0100.04720.10
5.5.80.0130.06720.23
5.5.70.0030.05020.16
5.5.60.0000.05720.17
5.5.50.0100.08020.25
5.5.40.0100.06020.09
5.5.30.0130.08320.23
5.5.20.0130.05320.20
5.5.10.0100.07320.16
5.5.00.0170.08320.11
5.4.450.0070.08019.50
5.4.440.0070.05019.41
5.4.430.0070.04719.32
5.4.420.0170.03319.24
5.4.410.0070.05319.39
5.4.400.0030.09019.23
5.4.390.0100.08019.08
5.4.380.0000.06019.19
5.4.370.0100.04318.89
5.4.360.0030.04319.09
5.4.350.0130.07018.96
5.4.340.0070.09019.09
5.4.320.0070.07318.95
5.4.310.0130.05318.98
5.4.300.0070.08019.09
5.4.290.0070.04319.09
5.4.280.0070.09019.09
5.4.270.0170.04719.16
5.4.260.0030.09719.27
5.4.250.0100.09718.98
5.4.240.0100.07719.16
5.4.230.0100.08019.08
5.4.220.0100.10019.07
5.4.210.0070.05319.24
5.4.200.0130.08018.85
5.4.190.0070.09019.09
5.4.180.0030.04319.23
5.4.170.0130.05718.88
5.4.160.0070.10319.14
5.4.150.0070.05319.16
5.4.140.0070.06016.50
5.4.130.0130.07016.53
5.4.120.0100.07716.50
5.4.110.0100.06716.58
5.4.100.0130.08716.60
5.4.90.0170.05016.53
5.4.80.0130.04316.40
5.4.70.0200.06316.47
5.4.60.0070.04316.39
5.4.50.0030.08016.43
5.4.40.0070.04016.53
5.4.30.0070.05316.42
5.4.20.0070.06016.57
5.4.10.0000.05316.40
5.4.00.0100.04715.98
5.3.290.0030.05015.70
5.3.280.0030.06715.70
5.3.270.0070.08715.70
5.3.260.0070.05315.70
5.3.250.0100.03715.70
5.3.240.0070.08715.70
5.3.230.0100.07315.70
5.3.220.0200.07715.70
5.3.210.0130.07715.70
5.3.200.0070.07015.70
5.3.190.0100.08315.70
5.3.180.0030.09315.70
5.3.170.0070.08715.70
5.3.160.0130.03715.70
5.3.150.0100.05015.70
5.3.140.0100.05315.70
5.3.130.0030.07715.70
5.3.120.0070.08315.70
5.3.110.0100.04015.70
5.3.100.0070.04015.70
5.3.90.0000.06315.70
5.3.80.0030.06315.70
5.3.70.0100.04015.70
5.3.60.0030.05015.70
5.3.50.0030.07315.70
5.3.40.0100.04015.70
5.3.30.0070.09015.70
5.3.20.0070.04015.70
5.3.10.0070.07715.70
5.3.00.0100.07315.70
5.2.170.0100.03715.70
5.2.160.0070.03315.70
5.2.150.0000.04715.70
5.2.140.0100.03715.70
5.2.130.0070.06015.70
5.2.120.0000.05015.70
5.2.110.0000.05015.70
5.2.100.0030.03715.70
5.2.90.0030.03315.70
5.2.80.0070.02315.70
5.2.70.0100.06315.70
5.2.60.0000.04715.70
5.2.50.0100.05715.70
5.2.40.0070.03715.70
5.2.30.0070.06015.70
5.2.20.0030.03315.70
5.2.10.0070.06015.70
5.2.00.0030.06015.70
5.1.60.0100.04315.70
5.1.50.0070.04315.70
5.1.40.0100.01715.70
5.1.30.0030.03315.70
5.1.20.0070.05315.70
5.1.10.0000.05015.70
5.1.00.0100.04715.70
5.0.50.0070.03715.70
5.0.40.0070.02715.70
5.0.30.0030.03715.70
5.0.20.0000.02315.70
5.0.10.0070.02315.70
5.0.00.0070.06715.70
4.4.90.0070.03015.70
4.4.80.0070.02315.70
4.4.70.0030.03315.70
4.4.60.0070.03015.70
4.4.50.0000.02015.70
4.4.40.0000.03015.70
4.4.30.0030.01715.70
4.4.20.0030.03015.70
4.4.10.0000.03715.70
4.4.00.0070.05015.70
4.3.110.0030.03015.70
4.3.100.0030.01715.70
4.3.90.0030.03315.70
4.3.80.0030.02315.70
4.3.70.0000.02315.70
4.3.60.0000.03315.70
4.3.50.0000.03715.70
4.3.40.0030.02715.70
4.3.30.0000.03715.70
4.3.20.0030.01715.70
4.3.10.0030.03015.70
4.3.00.0000.02715.70

preferences:
140.41 ms | 1394 KiB | 7 Q