3v4l.org

run code in 500+ 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.5.90.0090.00717.81
8.5.80.0100.00417.67
8.5.70.0080.00917.67
8.5.60.0090.00517.75
8.5.50.0120.00717.69
8.5.40.0110.00618.43
8.5.30.0090.00419.31
8.5.20.0070.00719.41
8.5.10.0170.00718.59
8.5.00.0140.00818.48
8.4.240.0100.01020.59
8.4.230.0140.00819.62
8.4.220.0150.00619.59
8.4.210.0160.00819.59
8.4.200.0250.00819.96
8.4.190.0160.01119.50
8.4.180.0110.00620.81
8.4.170.0110.01221.80
8.4.160.0110.01221.80
8.4.150.0110.00718.51
8.4.140.0100.01017.88
8.4.130.0060.00518.16
8.4.120.0130.00619.30
8.4.110.0070.01018.42
8.4.100.0150.00818.07
8.4.90.0130.00819.27
8.4.80.0120.01018.47
8.4.70.0090.00720.12
8.4.60.0140.01019.27
8.4.50.0090.00718.03
8.4.40.0150.00718.62
8.4.30.0120.00519.24
8.4.20.0230.00818.34
8.4.10.0240.00618.56
8.3.330.0140.00819.57
8.3.320.0100.00820.45
8.3.310.0120.00819.46
8.3.300.0120.01220.48
8.3.290.0140.00820.40
8.3.280.0130.01019.58
8.3.270.0120.01117.69
8.3.260.0140.00817.68
8.3.250.0060.00818.79
8.3.240.0130.00617.72
8.3.230.0140.00717.62
8.3.220.0110.00318.78
8.3.210.0150.00918.64
8.3.200.0100.00717.63
8.3.190.0100.00617.79
8.3.180.0110.00617.67
8.3.170.0130.00717.98
8.3.160.0130.00718.47
8.3.150.0240.00718.57
8.3.140.0220.00817.18
8.3.130.0150.00717.94
8.3.120.0170.00618.63
8.3.110.0180.00918.77
8.3.100.0220.00317.25
8.3.90.0190.00920.72
8.3.80.0190.00717.26
8.3.70.0190.01017.41
8.3.60.0200.01017.93
8.3.50.0180.01118.35
8.3.40.0240.00618.81
8.3.30.0190.00918.84
8.3.20.0160.00820.56
8.3.10.0210.00320.06
8.3.00.0170.00220.68
8.2.330.0120.01317.98
8.2.320.0140.00918.10
8.2.310.0140.00818.18
8.2.300.0180.00718.16
8.2.290.0200.00516.83
8.2.280.0160.00717.49
8.2.270.0190.01016.76
8.2.260.0200.00817.36
8.2.250.0220.00716.69
8.2.240.0190.00716.77
8.2.230.0150.00618.66
8.2.220.0150.00519.07
8.2.210.0160.00520.02
8.2.200.0190.00717.12
8.2.190.0230.00816.60
8.2.180.0230.00719.66
8.2.170.0190.00819.57
8.2.160.0240.00819.52
8.2.150.0230.00720.43
8.2.140.0190.00719.93
8.2.130.0180.00720.54
8.2.120.0220.00618.91
8.2.110.0210.00919.14
8.2.100.0240.00517.82
8.2.90.0210.00717.97
8.2.80.0210.00718.30
8.2.70.0200.00817.88
8.2.60.0150.00917.82
8.2.50.0210.00617.93
8.2.40.0230.00718.53
8.2.30.0220.00717.85
8.2.20.0220.00418.75
8.2.10.0210.00517.98
8.2.00.0160.00618.11
8.1.340.0250.00817.74
8.1.330.0200.00516.36
8.1.320.0180.00716.24
8.1.310.0230.00816.93
8.1.300.0240.00617.48
8.1.290.0190.00921.09
8.1.280.0230.00919.47
8.1.270.0280.00319.69
8.1.260.0170.00820.55
8.1.250.0150.01021.10
8.1.240.0150.00819.78
8.1.230.0180.00319.43
8.1.220.0170.00617.70
8.1.210.0150.00817.94
8.1.200.0170.00317.61
8.1.190.0190.00617.47
8.1.180.0150.01017.56
8.1.170.0160.00917.89
8.1.160.0190.00618.10
8.1.150.0140.00917.96
8.1.140.0190.00617.61
8.1.130.0150.00517.87
8.1.120.0130.00518.19
8.1.110.0110.00717.67
8.1.100.0150.00517.67
8.1.90.0120.00817.60
8.1.80.0120.00617.68
8.1.70.0120.00617.62
8.1.60.0130.00717.72
8.1.50.0150.00617.67
8.1.40.0150.00517.67
8.1.30.0190.00417.77
8.1.20.0160.00617.71
8.1.10.0160.00617.68
8.1.00.0160.00617.68
8.0.300.0170.00517.93
8.0.290.0160.00716.92
8.0.280.0190.00617.53
8.0.270.0140.00717.41
8.0.260.0100.00717.61
8.0.250.0110.00517.54
8.0.240.0100.00617.35
8.0.230.0110.00517.33
8.0.220.0120.00617.19
8.0.210.0140.00516.94
8.0.200.0140.00617.07
8.0.190.0150.00516.98
8.0.180.0140.00517.04
8.0.170.0180.00317.05
8.0.160.0140.00517.05
8.0.150.0130.00516.97
8.0.140.0130.00616.95
8.0.130.0150.00616.99
8.0.120.0140.00517.19
8.0.110.0130.00417.21
8.0.100.0150.00517.14
8.0.90.0130.00617.18
8.0.80.0140.00517.23
8.0.70.0140.00717.18
8.0.60.0130.00717.08
8.0.50.0140.00517.15
8.0.30.0120.00617.19
8.0.20.0120.00617.24
8.0.10.0120.00717.28
7.4.330.0090.00616.12
7.4.320.0140.00316.93
7.4.300.0120.00516.88
7.4.290.0130.00516.93
7.4.280.0140.00516.90
7.4.270.0150.00516.90
7.4.260.0140.00616.89
7.4.250.0150.00616.90
7.4.240.0130.00516.91
7.4.230.0160.00416.89
7.4.220.0150.00516.68
7.4.210.0110.00716.86
7.4.200.0120.00616.89
7.4.190.0110.00616.95
7.4.180.0120.00516.93
7.4.160.0110.00616.92
7.4.150.0100.00616.67
7.4.140.0110.00616.79
7.4.130.0100.00716.76
7.4.120.0110.00616.80
7.4.110.0120.00616.64
7.4.100.0130.00516.90
7.4.90.0110.00516.81
7.4.80.0100.00617.29
7.4.70.0120.00417.25
7.4.60.0100.00617.26
7.4.50.0140.00517.23
7.4.40.0130.00417.18
7.4.30.0110.00517.27
7.4.20.0100.00617.30
7.4.10.0110.00517.10
7.4.00.0100.00617.29

preferences:
54.06 ms | 1342 KiB | 5 Q