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; }); echo " <table> <tr> <td>1</td> <td>2</td> <td>3</td> </tr> <tr> <td>4</td> <td>5</td> <td>6</td> </tr> <tr> <td>7</td> <td>8</td> <td>9</td> </tr> </table> "; // 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.230.0100.03320.72
5.6.220.0000.04020.75
5.6.210.0070.04720.85
5.6.200.0130.08021.18
5.6.190.0170.07321.13
5.6.180.0030.09321.13
5.6.170.0170.08021.11
5.6.160.0100.05721.09
5.6.150.0070.09021.03
5.6.140.0100.08321.07
5.6.130.0070.09021.19
5.6.120.0130.08721.12
5.6.110.0030.08721.03
5.6.100.0100.08721.05
5.6.90.0130.08721.05
5.6.80.0200.07320.55
5.6.70.0070.08320.48
5.6.60.0170.08020.50
5.6.50.0000.08720.54
5.6.40.0030.06020.48
5.6.30.0170.07320.62
5.6.20.0100.07720.57
5.6.10.0130.08020.52
5.6.00.0070.08320.38
5.5.370.0030.05020.41
5.5.360.0070.04320.59
5.5.350.0000.05720.52
5.5.340.0230.06021.01
5.5.330.0230.08320.92
5.5.320.0100.08320.85
5.5.310.0170.08021.00
5.5.300.0130.08020.89
5.5.290.0070.08720.73
5.5.280.0070.09320.86
5.5.270.0100.05321.00
5.5.260.0170.08320.84
5.5.250.0170.08020.72
5.5.240.0100.07720.28
5.5.230.0070.08320.26
5.5.220.0100.08020.23
5.5.210.0100.07720.30
5.5.200.0070.07320.32
5.5.190.0070.08720.28
5.5.180.0030.07720.37
5.5.160.0100.07020.24
5.5.150.0070.07320.29
5.5.140.0100.05320.32
5.5.130.0030.08720.21
5.5.120.0100.07720.17
5.5.110.0070.08020.22
5.5.100.0100.09320.25
5.5.90.0100.08320.16
5.5.80.0100.08020.18
5.5.70.0100.07720.15
5.5.60.0100.08320.17
5.5.50.0000.08720.14
5.5.40.0170.07320.12
5.5.30.0200.07320.13
5.5.20.0100.08320.22
5.5.10.0100.06320.21
5.5.00.0200.07720.20
5.4.450.0030.08319.55
5.4.440.0130.07319.51
5.4.430.0170.07719.59
5.4.420.0070.08319.40
5.4.410.0130.07019.36
5.4.400.0030.08018.99
5.4.390.0100.08019.22
5.4.380.0070.06019.17
5.4.370.0070.08319.09
5.4.360.0100.07019.17
5.4.350.0170.07019.25
5.4.340.0170.07319.22
5.4.320.0070.04719.28
5.4.310.0030.07318.99
5.4.300.0030.08019.27
5.4.290.0030.07319.00
5.4.280.0070.08319.15
5.4.270.0130.07718.93
5.4.260.0070.08018.95
5.4.250.0100.07319.16
5.4.240.0100.08019.08
5.4.230.0170.06319.08
5.4.220.0130.07319.05
5.4.210.0200.07019.16
5.4.200.0000.08319.24
5.4.190.0030.08018.88
5.4.180.0130.07019.00
5.4.170.0130.06719.21
5.4.160.0100.08018.90
5.4.150.0130.07719.08
5.4.140.0130.07316.55
5.4.130.0100.07716.49
5.4.120.0100.07716.39
5.4.110.0070.08316.59
5.4.100.0100.07016.51
5.4.90.0100.08016.59
5.4.80.0070.07316.55
5.4.70.0070.07716.41
5.4.60.0000.09016.55
5.4.50.0100.07016.50
5.4.40.0070.07016.49
5.4.30.0030.08316.45
5.4.20.0100.07016.43
5.4.10.0100.07316.42
5.4.00.0130.07315.96
5.3.290.0200.06714.97
5.3.280.0100.04714.75
5.3.270.0000.09014.89
5.3.260.0030.08314.81
5.3.250.0170.07014.78
5.3.240.0070.08014.74
5.3.230.0070.07314.83
5.3.220.0030.07314.75
5.3.210.0100.08314.71
5.3.200.0070.07714.76
5.3.190.0070.07314.78
5.3.180.0100.06014.69
5.3.170.0070.07714.67
5.3.160.0000.08014.80
5.3.150.0100.07714.76
5.3.140.0030.08714.70
5.3.130.0000.06014.80
5.3.120.0130.06714.79
5.3.110.0030.04314.69
5.3.100.0170.05714.21
5.3.90.0030.06314.19
5.3.80.0070.07014.20
5.3.70.0030.08014.32
5.3.60.0030.08314.16
5.3.50.0130.05714.06
5.3.40.0170.06714.11
5.3.30.0100.07314.18
5.3.20.0100.06713.96
5.3.10.0130.06313.93
5.3.00.0100.07713.82
5.2.170.0030.05712.34
5.2.160.0030.06712.34
5.2.150.0070.06012.34
5.2.140.0100.05712.34
5.2.130.0130.05312.34
5.2.120.0030.03312.34
5.2.110.0000.06712.34
5.2.100.0070.05012.34
5.2.90.0030.04012.34
5.2.80.0100.05312.34
5.2.70.0070.06012.34
5.2.60.0030.06012.34
5.2.50.0070.05712.34
5.2.40.0000.06312.34
5.2.30.0030.06312.34
5.2.20.0030.06712.34
5.2.10.0000.05012.34
5.2.00.0030.05012.34
5.1.60.0070.05012.34
5.1.50.0030.05312.34
5.1.40.0070.04312.34
5.1.30.0030.04312.34
5.1.20.0100.04312.34
5.1.10.0070.05712.34
5.1.00.0070.05312.34
5.0.50.0000.04312.34
5.0.40.0070.04012.34
5.0.30.0000.05012.34
5.0.20.0070.04012.34
5.0.10.0000.05012.34
5.0.00.0100.05712.34
4.4.90.0000.02312.34
4.4.80.0000.02712.34
4.4.70.0000.02712.34
4.4.60.0030.03712.34
4.4.50.0030.03712.34
4.4.40.0030.05712.34
4.4.30.0030.03712.34
4.4.20.0000.03012.34
4.4.10.0000.03712.34
4.4.00.0000.03312.34
4.3.110.0030.02712.34
4.3.100.0000.02312.34
4.3.90.0070.03312.34
4.3.80.0030.05012.34
4.3.70.0070.03012.34
4.3.60.0070.03012.34
4.3.50.0000.03312.34
4.3.40.0070.04012.34
4.3.30.0000.02712.34
4.3.20.0030.02312.34
4.3.10.0000.02712.34
4.3.00.0030.03712.34

preferences:
137.56 ms | 1398 KiB | 7 Q