3v4l.org

run code in 300+ PHP versions simultaneously
<?php date_default_timezone_set('Europe/Berlin'); // birthdate format is YYYY-MM-DD $birth = new DateTime('1966-01-21'); $today = new DateTime('21-01-2011'); $diff = $birth->diff($today); echo $diff->format('%y') . PHP_EOL; // will output 45 $birth = new DateTime('1966-01-23'); $today = new DateTime('21-01-2011'); $diff = $birth->diff($today); echo $diff->format('%y') . PHP_EOL; // will output 45 wrongly $birth = new DateTime('1966-01-24'); // three days difference! $today = new DateTime('21-01-2011'); $diff = $birth->diff($today) . PHP_EOL; echo $diff->format('%y'); // will output 44 - correct ?>

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.3.70.0120.00918.43
8.3.60.0100.01016.86
8.3.50.0160.01122.13
8.3.40.0110.01118.91
8.3.30.0030.01019.13
8.3.20.0050.00220.35
8.3.10.0030.00523.70
8.3.00.0040.00420.83
8.2.180.0090.00616.63
8.2.170.0110.01122.96
8.2.160.0070.00720.38
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0050.00326.16
8.2.120.0080.00020.73
8.2.110.0090.00022.08
8.2.100.0040.00720.47
8.2.90.0060.00319.21
8.2.80.0030.00617.97
8.2.70.0090.00017.75
8.2.60.0060.00618.05
8.2.50.0090.00018.07
8.2.40.0080.00020.01
8.2.30.0060.00318.36
8.2.20.0030.00518.00
8.2.10.0000.00717.97
8.2.00.0030.00617.78
8.1.280.0110.00725.92
8.1.270.0040.00423.87
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0040.00422.11
8.1.230.0040.00818.82
8.1.220.0000.00817.74
8.1.210.0080.00018.77
8.1.200.0040.00417.48
8.1.190.0030.00517.38
8.1.180.0030.00518.10
8.1.170.0030.00518.60
8.1.160.0040.00422.02
8.1.150.0040.00418.71
8.1.140.0040.00417.58
8.1.130.0000.00717.81
8.1.120.0030.00317.64
8.1.110.0040.00417.54
8.1.100.0070.00017.63
8.1.90.0040.00417.61
8.1.80.0050.00317.65
8.1.70.0030.00317.57
8.1.60.0040.00417.73
8.1.50.0080.00017.61
8.1.40.0080.00017.67
8.1.30.0050.00317.86
8.1.20.0000.00717.79
8.1.10.0000.00717.70
8.1.00.0000.00917.57
8.0.300.0040.00418.77
8.0.290.0040.00417.00
8.0.280.0000.00718.45
8.0.270.0000.00717.33
8.0.260.0030.00317.32
8.0.250.0070.00017.13
8.0.240.0000.00717.12
8.0.230.0050.00317.15
8.0.220.0080.00017.15
8.0.210.0040.00417.03
8.0.200.0000.00617.07
8.0.190.0030.00517.23
8.0.180.0030.00517.18
8.0.170.0090.00017.09
8.0.160.0040.00417.09
8.0.150.0000.00717.07
8.0.140.0070.00017.14
8.0.130.0030.00313.60
8.0.120.0050.00317.02
8.0.110.0000.00817.04
8.0.100.0050.00316.97
8.0.90.0050.00317.05
8.0.80.0190.00317.08
8.0.70.0000.00717.09
8.0.60.0050.00217.04
8.0.50.0000.00716.90
8.0.30.0120.00617.29
8.0.20.0140.00717.40
8.0.10.0050.00217.23
8.0.00.0100.00716.93
7.4.330.0060.00015.15
7.4.320.0040.00416.65
7.4.300.0060.00016.66
7.4.290.0070.00016.71
7.4.280.0000.00816.77
7.4.270.0070.00016.71
7.4.260.0060.00316.53
7.4.250.0000.00716.68
7.4.240.0030.00316.57
7.4.230.0040.00416.53
7.4.220.0030.01516.63
7.4.210.0100.00716.76
7.4.200.0020.00516.55
7.4.160.0080.00816.73
7.4.150.0100.00717.40
7.4.140.0090.00917.86
7.4.130.0110.00816.66
7.4.120.0090.01016.73
7.4.110.0070.01016.63
7.4.100.0090.00916.71
7.4.90.0130.00316.69
7.4.80.0090.00919.39
7.4.70.0070.01016.57
7.4.60.0100.00617.00
7.4.50.0040.00416.58
7.4.40.0030.01416.74
7.4.30.0110.00516.71
7.4.00.0100.00715.18
7.3.330.0020.00213.21
7.3.320.0040.00413.33
7.3.310.0070.00016.25
7.3.300.0030.00316.32
7.3.290.0030.01016.38
7.3.280.0100.00916.38
7.3.270.0040.01417.40
7.3.260.0100.00716.29
7.3.250.0080.01316.59
7.3.240.0110.00616.67
7.3.230.0100.00616.39
7.3.210.0130.00316.46
7.3.200.0070.01019.39
7.3.190.0120.00916.52
7.3.180.0060.01316.55
7.3.170.0060.00916.66
7.3.160.0150.00016.63
7.3.120.0080.00814.92
7.2.330.0070.01116.62
7.2.320.0180.00716.45
7.2.310.0140.00316.63
7.2.300.0030.01516.57
7.2.290.0150.00616.71
7.2.60.0040.00817.08
7.2.00.0030.01019.62
7.1.200.0040.01216.00
7.1.100.0030.01017.77
7.1.70.0050.00217.24
7.1.60.0070.01719.70
7.1.50.0230.01634.81
7.1.00.0070.07322.30
7.0.200.0000.00816.91
7.0.140.0000.07021.97
7.0.60.0000.04719.91
7.0.50.0070.04017.84
7.0.40.0070.04319.90
7.0.30.0270.06720.01
7.0.20.0370.07320.00
7.0.10.0200.07020.00
7.0.00.0100.04720.04
5.6.280.0070.06721.10
5.6.210.0070.08020.66
5.6.200.0000.08718.11
5.6.190.0130.08320.64
5.6.180.3930.04320.61
5.6.170.0300.07320.39
5.6.160.0070.07720.44
5.6.150.0170.04318.18
5.6.140.0030.08318.11
5.6.130.0130.07718.22
5.6.120.0030.04021.03
5.6.110.0000.08720.97
5.6.100.0100.08320.93
5.6.90.0000.05721.12
5.6.80.0070.08020.38
5.6.70.3270.03320.55
5.5.350.0130.04020.42
5.5.340.0100.04317.99
5.5.330.0030.07020.14
5.5.320.2830.04020.27
5.5.310.0200.05020.29
5.5.300.0070.08017.91
5.5.290.0200.06718.01
5.5.280.0100.07720.86
5.5.270.0000.07320.79
5.5.260.0100.03320.85
5.5.250.0030.04320.49
5.5.240.0170.03320.15
5.4.450.0570.04729.93
5.4.440.0330.03729.93
5.4.430.0300.04329.92
5.4.420.0370.04329.48
5.4.410.0400.03728.29
5.4.400.0370.04028.29
5.4.390.0470.04728.29
5.4.380.0200.06018.56
5.4.370.0200.05018.68
5.4.360.0200.05018.76
5.4.350.0170.05318.50
5.4.340.0130.05318.67
5.4.320.0100.04712.46
5.4.310.0050.04712.46
5.4.300.0090.04012.46
5.4.290.0080.04612.45
5.4.280.0070.04112.35
5.4.270.0070.03712.36
5.4.260.0040.04012.36
5.4.250.0030.04112.35
5.4.240.0050.04012.35
5.4.230.0100.03412.35
5.4.220.0060.03812.34
5.4.210.0070.03612.35
5.4.200.0060.04212.34
5.4.190.0050.03912.34
5.4.180.0050.03712.34
5.4.170.0090.03812.35
5.4.160.0100.03412.35
5.4.150.0060.04012.34
5.4.140.0060.04112.03
5.4.130.0100.03512.01
5.4.120.0100.04311.97
5.4.110.0070.04911.96
5.4.100.0040.04311.97
5.4.90.0050.03911.97
5.4.80.0060.03711.96
5.4.70.0050.03811.96
5.4.60.0050.03911.96
5.4.50.0100.03711.96
5.4.40.0060.03811.95
5.4.30.0090.03611.95
5.4.20.0080.04211.95
5.4.10.0070.03711.95
5.4.00.0090.04211.44
5.3.290.0050.04112.80
5.3.280.0080.04512.71
5.3.270.0070.04512.73
5.3.260.0080.04012.72
5.3.250.0070.03912.72
5.3.240.0070.03912.72
5.3.230.0060.04112.71
5.3.220.0060.04312.68
5.3.210.0110.04112.68
5.3.200.0090.03912.68
5.3.190.0040.04212.68
5.3.180.0080.03612.67
5.3.170.0100.03512.67
5.3.160.0080.03812.67
5.3.150.0090.03812.67
5.3.140.0090.04012.66
5.3.130.0110.04212.66
5.3.120.0110.05112.66
5.3.110.0130.04912.66
5.3.100.0080.05312.12
5.3.90.0100.04212.09
5.3.80.0080.04712.08
5.3.70.0120.03912.07
5.3.60.0070.04412.06
5.3.50.0060.04012.00
5.3.40.0070.03712.00
5.3.30.0080.03811.95
5.3.20.0100.03511.73
5.3.10.0070.03911.69
5.3.00.0060.03811.69
5.2.170.0070.0339.19
5.2.160.0100.0299.19
5.2.150.0040.0349.19
5.2.140.0070.0339.19
5.2.130.0040.0419.14
5.2.120.0080.0319.15
5.2.110.0050.0329.15
5.2.100.0100.0259.15
5.2.90.0060.0379.15
5.2.80.0100.0379.15
5.2.70.0080.0389.15
5.2.60.0110.0359.09
5.2.50.0080.0389.07
5.2.40.0080.0369.04
5.2.30.0100.0399.02
5.2.20.0040.0389.01
5.2.10.0060.0368.93
5.2.00.0060.0298.79
5.1.60.0060.0308.07
5.1.50.0120.0288.06
5.1.40.0070.0288.04
5.1.30.0050.0328.40
5.1.20.0020.0408.42
5.1.10.0040.0308.14
5.1.00.0040.0368.14
5.0.50.0060.0236.64
5.0.40.0050.0256.50
5.0.30.0060.0346.30
5.0.20.0060.0206.28
5.0.10.0060.0246.26
5.0.00.0070.0426.25
4.4.90.0240.0564.78
4.4.80.0030.0174.76
4.4.70.0010.0204.76
4.4.60.0030.0194.75
4.4.50.0010.0184.77
4.4.40.0000.0294.71
4.4.30.0030.0164.76
4.4.20.0090.0184.84
4.4.10.0040.0194.85
4.4.00.0070.0294.76
4.3.110.0040.0214.67
4.3.100.0030.0224.67
4.3.90.0050.0194.63
4.3.80.0030.0314.59
4.3.70.0020.0214.63
4.3.60.0030.0244.63
4.3.50.0030.0204.63
4.3.40.0020.0324.54
4.3.30.0050.0193.30
4.3.20.0030.0213.27
4.3.10.0020.0213.24
4.3.00.0370.01028.29

preferences:
40.24 ms | 401 KiB | 5 Q