3v4l.org

run code in 300+ PHP versions simultaneously
<?php $dt = new StdClass; $dt->now = new DateTime(); $occurredOn = new DateTime('2014-09-23'); // new DateTime(); $dt->lastUpdated = $occurredOn; $dt->interval = $dt->now->diff($dt->lastUpdated); $dt->remainingHours = $occurredOn; $dt->remainingHours->add(new DateInterval("PT4H")); $dt->remainingHours = $dt->remainingHours->diff($dt->now); $dt->remainingHours = timeRemainingInFourHours($dt->remainingHours); $dt->title = formatDateInterval($dt->interval); function timeRemainingInFourHours(DateInterval $interval) { $hours = ""; $minutes = ""; if ($interval->h) { $hours = $interval->format("%h") . " hours"; } if ($interval->i) { $minutes = $interval->format("%i") . " minutes"; } return $hours . $minutes . ' remaining'; } function formatDateInterval(DateInterval $interval) { $result = ""; // ternary? if ($interval->y) { $result .= $interval->format("%y years "); } if ($interval->m) { $result .= $interval->format("%m months "); } if ($interval->d) { $result .= $interval->format("%d days "); } if ($interval->h) { $result .= $interval->format("%h hours "); } if ($interval->i) { $result .= $interval->format("%i minutes "); } if ($interval->s) { $result .= $interval->format("%s seconds "); } else { $result .= "hot off the press"; } return $result; } var_dump($dt);

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)
8.0.110.0040.00417.21
8.0.100.0080.00017.10
8.0.90.0000.00717.05
8.0.80.0120.00617.18
8.0.70.0000.00817.09
8.0.60.0070.00017.09
8.0.50.0050.00317.26
8.0.30.0110.00817.25
8.0.20.0080.01217.41
8.0.10.0000.00717.31
8.0.00.0050.01316.86
7.4.240.0030.00516.64
7.4.230.0040.00416.80
7.4.220.0140.00316.80
7.4.210.0030.01116.80
7.4.200.0000.00716.78
7.4.160.0150.00416.64
7.4.150.0250.00317.40
7.4.140.0050.01417.86
7.4.130.0080.01516.80
7.4.120.0120.00816.69
7.4.110.0030.01416.88
7.4.100.0140.00416.69
7.4.90.0100.01016.78
7.4.80.0150.00819.39
7.4.70.0130.00316.72
7.4.60.0160.00316.91
7.4.50.0030.00316.60
7.4.40.0070.01016.95
7.4.30.0140.00416.47
7.4.00.0140.00015.36
7.3.300.0040.00216.60
7.3.290.0090.00616.48
7.3.280.0070.01016.48
7.3.270.0160.00617.40
7.3.260.0190.00616.70
7.3.250.0120.01016.74
7.3.240.0080.01116.56
7.3.230.0110.00416.61
7.3.210.0120.00616.62
7.3.200.0100.01016.68
7.3.190.0130.00516.66
7.3.180.0090.00916.76
7.3.170.0060.01216.82
7.3.160.0110.00616.93
7.2.330.0190.00017.02
7.2.320.0140.00916.96
7.2.310.0090.00916.73
7.2.300.0150.00316.77
7.2.290.0110.00716.97
7.2.60.0030.01216.72
7.2.00.0060.00919.71
7.1.200.0070.00316.06
7.1.100.0060.00618.29
7.1.70.0000.01017.41
7.1.60.0120.01219.61
7.1.50.0230.01335.00
7.1.00.0100.07022.43
7.0.200.0060.00316.94
7.0.140.0070.07022.18
7.0.60.0100.03320.13
7.0.50.0070.08017.90
7.0.40.0170.07319.96
7.0.30.0200.08720.28
7.0.20.0130.05320.10
7.0.10.0070.09320.15
7.0.00.0030.04020.15
5.6.280.0030.07721.09
5.6.210.0170.08020.48
5.6.200.0070.08318.16
5.6.190.0130.08020.62
5.6.180.0300.08020.48
5.6.170.0300.07720.62
5.6.160.0100.04320.57
5.6.150.0030.05018.21
5.6.140.0130.04318.23
5.6.130.0100.04318.21
5.6.120.0100.04020.95
5.6.110.0100.08021.02
5.6.100.0200.07321.09
5.6.90.0100.06021.14
5.6.80.0100.07320.41
5.6.70.4100.04320.41
5.5.350.0100.06720.40
5.5.340.0100.06718.05
5.5.330.0070.03720.40
5.5.320.0170.04320.42
5.5.310.0270.05320.36
5.5.300.0030.06718.08
5.5.290.0100.06317.98
5.5.280.0030.06720.79
5.5.270.0230.06020.90
5.5.260.0130.07720.98
5.5.250.0100.08020.70
5.5.240.0100.07720.13
5.4.450.0370.04719.59
5.4.440.0270.04019.48
5.4.430.0430.04319.41
5.4.420.0200.03719.41
5.4.410.0400.03319.44
5.4.400.0230.04719.00
5.4.390.0470.03319.15
5.4.380.0130.06718.79
5.4.370.0270.07018.82
5.4.360.0270.04718.57
5.4.350.0400.05318.54
5.4.340.0500.05718.68
5.4.320.0060.03712.52
5.4.310.0090.03512.51
5.4.300.0080.03612.52
5.4.290.0060.03912.52
5.4.280.0050.03712.41
5.4.270.0070.03612.41
5.4.260.0090.03512.41
5.4.250.0040.04012.41
5.4.240.0060.03612.41
5.4.230.0030.04212.40
5.4.220.0100.03212.40
5.4.210.0100.03212.40
5.4.200.0100.03612.41
5.4.190.0030.04212.40
5.4.180.0060.03712.40
5.4.170.0070.04312.41
5.4.160.0100.04212.40
5.4.150.0050.04312.40
5.4.140.0090.03712.08
5.4.130.0110.03212.07
5.4.120.0110.03812.03
5.4.110.0110.03712.02
5.4.100.0090.04112.02
5.4.90.0090.04612.02
5.4.80.0070.04212.02
5.4.70.0060.03812.02
5.4.60.0080.03712.02
5.4.50.0090.03412.02
5.4.40.0070.03712.01
5.4.30.0060.04112.00
5.4.20.0060.03412.00
5.4.10.0080.03412.00
5.4.00.0060.04511.50
5.3.290.0080.03712.80
5.3.280.0100.04012.71
5.3.270.0090.04212.72
5.3.260.0060.04112.72
5.3.250.0100.03412.72
5.3.240.0090.03312.72
5.3.230.0070.03812.71
5.3.220.0050.04612.68
5.3.210.0050.03912.68
5.3.200.0100.03312.68
5.3.190.0070.03812.68
5.3.180.0060.03612.67
5.3.170.0060.04212.67
5.3.160.0060.03612.68
5.3.150.0100.03912.68
5.3.140.0080.03912.66
5.3.130.0030.04112.66
5.3.120.0090.04412.66
5.3.110.0070.04112.65
5.3.100.0070.03812.13
5.3.90.0060.03712.11
5.3.80.0040.03912.10
5.3.70.0090.03312.10
5.3.60.0050.04012.09
5.3.50.0040.04112.03
5.3.40.0070.03512.04
5.3.30.0110.03412.00
5.3.20.0100.03511.78
5.3.10.0080.03611.74
5.3.00.0070.03511.74
5.2.170.0060.0289.24
5.2.160.0060.0309.24
5.2.150.0040.0299.24
5.2.140.0060.0389.23
5.2.130.0020.0319.19
5.2.120.0030.0299.20
5.2.110.0060.0279.20
5.2.100.0040.0289.19
5.2.90.0060.0299.20
5.2.80.0060.0279.19
5.2.70.0050.0299.19
5.2.60.0040.0349.15
5.2.50.0050.0319.12
5.2.40.0030.0309.09
5.2.30.0020.0379.06
5.2.20.0070.0339.05
5.2.10.0060.0268.96
5.2.00.0050.0278.82
5.1.60.0060.0298.10
5.1.50.0030.0258.10
5.1.40.0040.0268.08
5.1.30.0040.0268.43
5.1.20.0100.0278.45
5.1.10.0070.0278.18
5.1.00.0050.0248.18
5.0.50.0040.0266.67
5.0.40.0030.0206.53
5.0.30.0030.0306.34
5.0.20.0030.0266.30
5.0.10.0030.0226.29
5.0.00.0050.0446.28
4.4.90.0040.0134.78
4.4.80.0010.0174.76
4.4.70.0030.0154.75
4.4.60.0030.0184.75
4.4.50.0050.0214.77
4.4.40.0020.0294.71
4.4.30.0020.0154.76
4.4.20.0040.0154.84
4.4.10.0020.0174.85
4.4.00.0020.0284.76
4.3.110.0020.0184.67
4.3.100.0010.0184.66
4.3.90.0040.0184.64
4.3.80.0020.0254.58
4.3.70.0030.0154.63
4.3.60.0040.0134.63
4.3.50.0060.0214.63
4.3.40.0050.0244.54
4.3.30.0020.0163.32
4.3.20.0010.0173.30
4.3.10.0030.0193.25
4.3.00.0030.01313.57

preferences:
26.33 ms | 401 KiB | 5 Q