3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function calcDays($startdate, $enddate) { $first = $startdate < $enddate ? $startdate : $enddate; $second = $startdate < $enddate ? $enddate : $startdate; $inbetween = $second - $first; $i[0] = 60; $i[1] = 24; $i[2] = 7; $i[3] = date('t', strtotime('-1 month', $second)); $i[4] = date('L', strtotime('-1 year', $second)) ? 366 : 365; $i[5] = array(31, (date('L', strtotime('-1 year', $second)) ? 28 : 29), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); $month = floor($inbetween / $i[0] / $i[0] / $i[1] / $i[3] % $i[4]); for($n = 0; $n < 12; $n++) { $temp = $inbetween / $i[0] / $i[0] / $i[1]; $tempMonth = date('n', strtotime('-1 year', $second)) - 1; if($temp > $i[5][$tempMonth]) { $temp -= $i[5][$tempMonth]; } else { $days = $i[5][$tempMonth]; break; } } $hours = floor($inbetween / $i[0] / $i[0] % $i[1]); $minutes = floor($inbetween / $i[0] % $i[0]); $seconds = $inbetween % $i[0]; return $month . " " . $days . " " . $hours . " " . $minutes . " " . $seconds . " " . $inbetween; } echo calcDays(1388389156, 1419925156);

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).
Note: hhvm uses a JIT which only kicks in after a few runs. Since we run scripts only once, hhvm always runs slower.

VersionSystem time (s)User time (s)Memory (MiB)
7.3.0rc60.0030.01016.84
7.3.0rc40.0380.01098.97
7.3.0rc30.0120.00516.88
7.3.0beta10.0040.00413.16
7.3.0alpha10.0040.00713.09
7.2.60.0070.00717.31
7.1.200.0060.00616.21
7.1.100.0060.00918.41
7.1.70.0000.01017.45
7.1.60.0090.00317.50
7.1.50.0370.01232.88
7.1.00.0100.04022.57
7.0.200.0000.01516.79
7.0.140.0100.06722.08
7.0.100.0130.05020.01
7.0.90.0000.05019.91
7.0.80.0100.03720.00
7.0.70.0070.04319.96
7.0.60.0030.04019.96
7.0.50.0130.06720.32
7.0.40.0170.04720.09
7.0.30.0070.08320.03
7.0.20.0030.09020.04
7.0.10.0100.08020.14
7.0.00.0030.04020.02
5.6.280.0000.07721.16
5.6.250.0030.04320.68
5.6.240.0030.05720.59
5.6.230.0000.04720.76
5.6.220.0070.04720.56
5.6.210.0000.04320.51
5.6.200.0030.04321.10
5.6.190.0100.08321.11
5.6.180.0070.08321.12
5.6.170.0000.04321.12
5.6.160.0200.07320.97
5.6.150.0000.08721.06
5.6.140.0100.06021.00
5.6.130.0100.08321.06
5.6.120.0170.06321.07
5.6.110.0070.07721.14
5.6.100.0100.08320.95
5.6.90.0100.08721.10
5.6.80.0130.07720.36
5.6.70.0170.03720.41
5.6.60.0070.03720.41
5.6.50.0100.07720.39
5.6.40.0030.08020.33
5.6.30.0070.03720.29
5.6.20.0130.07320.41
5.6.10.0000.08320.47
5.6.00.0200.07020.32
5.5.380.0030.04020.58
5.5.370.0070.03720.38
5.5.360.0070.05020.43
5.5.350.0070.04020.41
5.5.340.0100.03720.89
5.5.330.0100.08020.93
5.5.320.0070.08020.81
5.5.310.0100.07720.75
5.5.300.0030.04320.95
5.5.290.0100.07320.88
5.5.280.0000.06020.75
5.5.270.0130.07720.84
5.5.260.0070.08320.74
5.5.250.0130.08020.59
5.5.240.0200.07020.28
5.5.230.0100.08320.24
5.5.220.0100.03320.29
5.5.210.0070.08020.04
5.5.200.0130.07720.26
5.5.190.0000.07320.15
5.5.180.0100.05720.26
5.5.160.0070.07720.14
5.5.150.0000.07320.13
5.5.140.0200.06320.01
5.5.130.0170.06320.01
5.5.120.0070.08020.20
5.5.110.0100.07020.17
5.5.100.0130.07720.14
5.5.90.0100.06720.13
5.5.80.0170.07720.18
5.5.70.0200.07020.11
5.5.60.0100.06720.11
5.5.50.0130.07320.08
5.5.40.0200.07020.03
5.5.30.0070.07720.08
5.5.20.0130.04720.04
5.5.10.0100.06720.13
5.5.00.0130.07320.05
5.4.450.0070.03719.50
5.4.440.0070.08019.35
5.4.430.0130.05019.20
5.4.420.0170.06719.45
5.4.410.0130.06319.34
5.4.400.0070.06319.01
5.4.390.0100.07719.04
5.4.380.0070.05719.13
5.4.370.0030.08019.05
5.4.360.0130.07018.90
5.4.350.0100.06319.18
5.4.340.0130.03318.95
5.4.320.0170.07319.13
5.4.310.0100.05319.23
5.4.300.0070.07318.90
5.4.290.0070.05318.87
5.4.280.0130.04019.18
5.4.270.0100.07319.09
5.4.260.0030.05018.96
5.4.250.0000.07719.02
5.4.240.0030.07719.20
5.4.230.0100.07718.87
5.4.220.0100.07019.03
5.4.210.0070.08019.13
5.4.200.0070.07319.22
5.4.190.0000.08319.13
5.4.180.0030.04019.11
5.4.170.0030.06318.86
5.4.160.0070.07018.88
5.4.150.0170.06719.21
5.4.140.0070.08316.50
5.4.130.0070.07316.46
5.4.120.0070.04716.41
5.4.110.0070.07316.56
5.4.100.0100.07316.48
5.4.90.0030.07716.38
5.4.80.0100.06716.48
5.4.70.0030.04316.55
5.4.60.0100.06716.45
5.4.50.0100.04016.48
5.4.40.0070.05016.51
5.4.30.0130.06716.31
5.4.20.0130.06716.49
5.4.10.0000.05316.47
5.4.00.0100.07015.81
5.3.290.0030.08314.86
5.3.280.0000.08714.86
5.3.270.0070.07714.86
5.3.260.0030.04314.86
5.3.250.0070.07314.86
5.3.240.0030.06014.86
5.3.230.0070.07714.86
5.3.220.0070.07314.86
5.3.210.0170.06714.86
5.3.200.0030.07714.86
5.3.190.0030.07714.86
5.3.180.0170.06314.86
5.3.170.0130.06014.86
5.3.160.0130.07014.86
5.3.150.0030.07714.86
5.3.140.0070.07014.86
5.3.130.0070.07314.86
5.3.120.0070.05314.86
5.3.110.0070.07014.86
5.3.100.0000.08014.86
5.3.90.0130.06014.86
5.3.80.0030.05714.86
5.3.70.0070.05714.86
5.3.60.0070.06714.86
5.3.50.0030.04314.86
5.3.40.0100.06714.86
5.3.30.0070.04314.86
5.3.20.0070.07014.86
5.3.10.0070.07714.86
5.3.00.0070.06314.86
5.2.170.0030.03314.86
5.2.160.0100.02714.86
5.2.150.0070.05714.86
5.2.140.0070.05014.86
5.2.130.0070.03714.86
5.2.120.0100.03314.86
5.2.110.0030.06314.86
5.2.100.0070.06314.86
5.2.90.0030.06014.86
5.2.80.0030.06014.86
5.2.70.0030.06314.86
5.2.60.0100.03314.86
5.2.50.0100.05314.86
5.2.40.0200.05014.86
5.2.30.0070.06014.86
5.2.20.0100.05714.86
5.2.10.0100.04714.86
5.2.00.0030.05314.86
5.1.60.0000.03314.86
5.1.50.0030.05714.86
5.1.40.0100.05014.86
5.1.30.0070.03014.86
5.1.20.0100.05314.86
5.1.10.0070.04314.86
5.1.00.0070.05314.86
5.0.50.0100.02314.86
5.0.40.0030.04714.86
5.0.30.0000.06714.86
5.0.20.0070.02714.86
5.0.10.0030.03314.86
5.0.00.0030.06714.86
4.4.90.0000.03314.86
4.4.80.0030.03314.86
4.4.70.0100.03014.86
4.4.60.0000.04014.86
4.4.50.0100.01314.86
4.4.40.0130.03014.86
4.4.30.0000.03314.86
4.4.20.0000.02714.86
4.4.10.0030.03714.86
4.4.00.0030.05714.86
4.3.110.0070.01314.86
4.3.100.0030.03314.86
4.3.90.0100.02714.86
4.3.80.0000.05314.86
4.3.70.0070.02314.86
4.3.60.0030.01714.86
4.3.50.0070.03014.86
4.3.40.0000.05714.86
4.3.30.0000.03014.86
4.3.20.0000.03714.86
4.3.10.0030.03714.86
4.3.00.0030.03314.86