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; }); // 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.2.100.0130.00714.25
7.2.90.0110.00814.30
7.2.80.0310.00914.42
7.2.70.0820.00014.73
7.2.60.1390.00914.73
7.2.50.0060.01214.29
7.2.40.0130.00414.87
7.2.30.0990.00714.81
7.2.20.0140.00614.86
7.2.10.0170.00514.74
7.2.00.0890.00714.54
7.1.220.0080.01113.69
7.1.210.0130.01013.24
7.1.200.1330.00613.14
7.1.190.0790.00613.34
7.1.180.0420.00313.27
7.1.170.0130.00013.38
7.1.160.1630.00613.41
7.1.150.1460.00713.50
7.1.140.0150.00513.27
7.1.130.1880.01113.33
7.1.120.0180.00413.38
7.1.110.0150.00513.57
7.1.100.0080.00413.59
7.1.90.1250.01213.59
7.1.80.0940.00913.52
7.1.70.0120.00413.49
7.1.60.0240.01031.48
7.1.50.0450.01131.30
7.1.40.1850.00731.75
7.1.30.1730.00631.53
7.1.20.0640.01231.56
7.1.10.0810.00613.23
7.1.00.0190.00313.54
7.0.310.0900.00413.18
7.0.300.0100.01113.44
7.0.290.1470.00713.16
7.0.280.0060.00912.91
7.0.270.1790.00013.15
7.0.260.0090.00412.93
7.0.250.1420.00012.96
7.0.240.0110.00312.73
7.0.230.0120.01113.13
7.0.220.0090.00913.30
7.0.210.1110.00613.02
7.0.200.0940.00413.25
7.0.190.1620.00013.05
7.0.180.1590.01513.13
7.0.170.0080.00813.04
7.0.160.0330.00013.04
7.0.150.0980.00912.93
7.0.140.1070.00413.11
7.0.130.2570.00913.02
7.0.120.1910.00713.38
7.0.110.0160.00513.22
7.0.100.0170.00913.40
7.0.90.2130.00313.25
7.0.80.2060.00313.41
7.0.70.0510.00813.29
7.0.60.0670.00013.36
7.0.50.0070.01313.33
7.0.40.0630.00613.18
7.0.30.0150.00013.17
7.0.20.0110.00413.22
7.0.10.0830.01413.10
7.0.00.2060.00613.28
5.6.380.0150.00714.34
5.6.370.0150.00414.39
5.6.360.0130.00314.36
5.6.350.0050.01314.82
5.6.340.0090.00914.67
5.6.330.0170.00614.60
5.6.320.0030.01314.70
5.6.310.0090.01114.73
5.6.300.0050.01114.24
5.6.290.0160.00814.53
5.6.280.0120.01214.73
5.6.270.0100.00714.64
5.6.260.0040.01314.29
5.6.250.0090.01114.75
5.6.240.0100.01014.78
5.6.230.0200.00914.47
5.6.220.0140.00414.69
5.6.210.0120.01214.43
5.6.200.0150.00414.57
5.6.190.0110.00714.44
5.6.180.0100.01014.59
5.6.170.0100.01614.60
5.6.160.0120.01314.25
5.6.150.0180.00914.31
5.6.140.0090.01414.27
5.6.130.0110.00714.37
5.6.120.0070.01014.38
5.6.110.0070.00914.68
5.6.100.0150.00414.46
5.6.90.0040.01214.59
5.6.80.0180.00014.18
5.6.70.0160.00514.26
5.6.60.0060.01514.52
5.6.50.0130.00614.43
5.6.40.0060.01214.35
5.6.30.0070.01214.27
5.6.20.0090.00914.34
5.6.10.0140.00914.30
5.6.00.0110.01114.71
5.5.380.0140.00012.46
5.5.370.0080.01312.46
5.5.360.0070.01312.46
5.5.350.0110.00712.46
5.5.340.0090.00912.46
5.5.330.0100.01012.46
5.5.320.0070.00712.46
5.5.310.0140.00712.46
5.5.300.0080.00812.46
5.5.290.0080.00612.46
5.5.280.0100.00512.46
5.5.270.0080.00812.46
5.5.260.0050.01012.46
5.5.250.0000.01512.46
5.5.240.0130.00312.46
5.5.230.0100.00612.46
5.5.220.0080.00812.46
5.5.210.0050.00912.46
5.5.200.0080.00812.46
5.5.190.0030.01312.46
5.5.180.0140.00612.46
5.5.170.0160.00014.50
5.5.160.0080.00812.46
5.5.150.0100.01312.46
5.5.140.0140.00712.46
5.5.130.0040.01212.46
5.5.120.0140.00312.46
5.5.110.0160.00012.46
5.5.100.0060.01312.46
5.5.90.0120.00512.46
5.5.80.0030.01412.46
5.5.70.0200.00012.46
5.5.60.0140.00312.46
5.5.50.0000.01712.46
5.5.40.0070.01812.46
5.5.30.0120.01312.46
5.5.20.0140.00512.46
5.5.10.0100.00512.46
5.5.00.0100.00712.46
5.4.450.0110.00812.46
5.4.440.0080.00812.46
5.4.430.0080.01112.46
5.4.420.0050.01212.46
5.4.410.0040.01112.46
5.4.400.0140.00312.46
5.4.390.0080.01312.46
5.4.380.0120.00412.46
5.4.370.0090.00912.46
5.4.360.0180.00012.46
5.4.350.0210.00012.46
5.4.340.0110.00612.46
5.4.330.0080.01112.46
5.4.320.0110.01112.46
5.4.310.0050.01012.46
5.4.300.0120.00412.46
5.4.290.0130.00412.46
5.4.280.0080.00812.46
5.4.270.0120.00612.46
5.4.260.0090.01212.46
5.4.250.0100.00712.46
5.4.240.0080.00812.46
5.4.230.0100.00712.46
5.4.220.0190.00012.46
5.4.210.0070.01412.46
5.4.200.0100.00712.46
5.4.190.0200.00312.46
5.4.180.0070.01112.46
5.4.170.0120.00212.46
5.4.160.0050.01312.46
5.4.150.0090.00912.46
5.4.140.0130.00512.46
5.4.130.0130.00612.46
5.4.120.0090.00912.46
5.4.110.0080.01112.46
5.3.290.0000.01812.46
5.3.280.0090.00912.46
5.3.270.0120.00412.46
5.3.260.0140.00712.46
5.3.250.0130.00512.46
5.3.240.0080.00812.46
5.3.230.0110.01112.46
5.3.220.0100.01012.46
5.3.210.0130.00412.46

preferences:
143.55 ms | 1394 KiB | 7 Q