3v4l.org

run code in 300+ PHP versions simultaneously
<?php $datetime1 = new DateTime('2017-04-26 18:13:06'); $datetime2 = new DateTime('2011-01-17 17:13:00'); // change the millenium to see output difference $diff = $datetime1->diff($datetime2); // this will get you very close, but it will not pad the digits to conform with your expected format echo "Raw Difference: " . $diff->format('%y years %m months %d days %h hours %i minutes %s seconds') . "\n"; // Notice the impact when you change $datetime2's millenium from '1' to '2' echo "Invalid format: " . $diff->format('%Y-%m-%d %H:%i:%s') . "\n"; // only H does it right $details = array_intersect_key((array)$diff,array_flip(['y','m','d','h','i','s'])); echo '$diff = ' . var_export($details, true) . "\n"; printf("Valid format: %04d-%02d-%02d %02d:%02d:%02d", $diff->y, $diff->m, $diff->d, $diff->h, $diff->i, $diff->s); // now all components of datetime are properly padded

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.4.120.0100.00820.80
8.4.110.0080.01418.81
8.4.100.0150.00818.04
8.4.90.0130.00720.72
8.4.80.0100.01119.05
8.4.70.0060.00320.52
8.4.60.0110.00920.45
8.4.50.0040.00518.02
8.4.40.0180.00419.47
8.4.30.0100.00020.70
8.4.20.0250.00818.55
8.4.10.0260.00618.08
8.3.250.0030.00719.04
8.3.240.0130.00716.83
8.3.230.0110.00816.54
8.3.220.0050.00318.93
8.3.210.0100.01018.50
8.3.200.0040.00516.85
8.3.190.0040.00517.19
8.3.180.0050.00216.71
8.3.170.0090.00917.26
8.3.160.0150.00418.43
8.3.150.0280.00618.55
8.3.140.0270.00716.49
8.3.130.0170.00417.63
8.3.120.0160.00618.59
8.3.110.0200.00818.75
8.3.100.0240.00316.55
8.3.90.0230.00721.79
8.3.80.0220.00616.62
8.3.70.0220.01116.73
8.3.60.0230.00917.58
8.3.50.0220.01018.21
8.3.40.0240.00718.27
8.3.30.0190.01118.41
8.3.20.0170.00720.93
8.3.10.0200.00221.09
8.3.00.0170.00021.97
8.2.290.0140.00516.86
8.2.280.0040.00418.36
8.2.270.0160.01016.90
8.2.260.0150.00817.72
8.2.250.0190.00716.70
8.2.240.0140.00516.88
8.2.230.0090.00419.73
8.2.220.0090.00420.27
8.2.210.0090.00421.86
8.2.200.0120.00417.43
8.2.190.0190.00916.58
8.2.180.0220.00721.18
8.2.170.0170.00920.40
8.2.160.0230.00520.23
8.2.150.0210.00521.63
8.2.140.0170.00720.98
8.2.130.0180.00621.89
8.2.120.0180.00619.38
8.2.110.0170.00919.81
8.2.100.0200.00517.74
8.2.90.0180.00617.93
8.2.80.0190.00518.44
8.2.70.0160.00717.81
8.2.60.0140.01017.74
8.2.50.0180.00517.87
8.2.40.0220.00618.79
8.2.30.0190.00517.75
8.2.20.0200.00319.01
8.2.10.0190.00317.95
8.2.00.0130.00518.13
8.1.330.0140.00516.57
8.1.320.0090.01016.09
8.1.310.0210.00817.40
8.1.300.0230.00618.00
8.1.290.0130.01023.54
8.1.280.0180.00921.03
8.1.270.0230.00220.60
8.1.260.0120.00721.91
8.1.250.0090.01122.74
8.1.240.0120.01120.71
8.1.230.0210.00320.22
8.1.220.0190.00717.60
8.1.210.0160.01017.99
8.1.200.0200.00317.49
8.1.190.0160.00517.32
8.1.180.0130.00917.64
8.1.170.0150.00817.96
8.1.160.0180.00518.18
8.1.150.0100.01117.98
8.1.140.0180.00517.47
8.1.130.0130.00517.86
8.1.120.0110.00518.24
8.1.110.0110.00717.62
8.1.100.0140.00517.62
8.1.90.0100.00817.58
8.1.80.0110.00517.65
8.1.70.0110.00417.60
8.1.60.0130.00717.69
8.1.50.0140.00517.63
8.1.40.0140.00517.64
8.1.30.0190.00317.74
8.1.20.0150.00617.67
8.1.10.0150.00717.64
8.1.00.0150.00517.66
8.0.300.0170.00318.28
8.0.290.0150.00716.80
8.0.280.0170.00617.65
8.0.270.0140.00717.49
8.0.260.0090.00717.76
8.0.250.0100.00417.59
8.0.240.0100.00517.05
8.0.230.0110.00517.06
8.0.220.0120.00616.88
8.0.210.0130.00516.93
8.0.200.0120.00517.04
8.0.190.0140.00416.97
8.0.180.0120.00517.00
8.0.170.0160.00317.04
8.0.160.0120.00517.00
8.0.150.0120.00416.94
8.0.140.0120.00616.92
8.0.130.0140.00616.95
8.0.120.0150.00416.94
8.0.110.0140.00416.95
8.0.100.0150.00516.92
8.0.90.0130.00616.92
8.0.80.0140.00516.97
8.0.70.0140.00616.92
8.0.60.0140.00616.87
8.0.50.0140.00416.91
8.0.30.0120.00616.92
8.0.20.0120.00616.96
8.0.10.0120.00617.01
7.4.330.0090.00515.69
7.4.320.0150.00216.68
7.4.300.0120.00416.65
7.4.290.0130.00416.67
7.4.280.0150.00516.64
7.4.270.0150.00516.64
7.4.260.0150.00516.63
7.4.250.0150.00516.65
7.4.240.0130.00516.65
7.4.230.0170.00316.63
7.4.220.0140.00516.64
7.4.210.0100.00716.62
7.4.200.0120.00516.63
7.4.190.0110.00616.71
7.4.180.0120.00516.71
7.4.160.0110.00616.65
7.4.150.0100.00616.64
7.4.140.0120.00616.56
7.4.130.0100.00716.57
7.4.120.0110.00616.58
7.4.110.0110.00616.60
7.4.100.0130.00516.66
7.4.90.0120.00516.57
7.4.80.0100.00617.12
7.4.70.0120.00417.10
7.4.60.0100.00617.08
7.4.50.0150.00517.05
7.4.40.0130.00417.00
7.4.30.0110.00517.10
7.4.20.0100.00617.11
7.4.10.0110.00517.13
7.4.00.0100.00617.11

preferences:
29.28 ms | 403 KiB | 5 Q