3v4l.org

run code in 300+ PHP versions simultaneously
<?php try { function hello_1(?string $whom): ?string { if ($whom !== null) { return "Hello $whom"; } } var_dump(hello_1(null)); } catch (\Error $e) { echo $e->getMessage() . PHP_EOL; } /*try { function hello_2(?string $whom): ?string { if ($whom !== null) { return "Hello $whom"; } return; } var_dump(hello_2(null)); } catch (\Error $e) { echo $e->getMessage() . PHP_EOL; } Fatal error: A function with return type must return a value (did you mean "return null;" instead of "return;"?) in /in/QRj2G on line 20 */ try { function hello_3(?string $whom): ?string { if ($whom !== null) { return "Hello $whom"; } return null; } var_dump(hello_3(null)); } catch (\Error $e) { echo $e->getMessage() . PHP_EOL; }

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.0160.00320.82
8.4.110.0100.01022.41
8.4.100.0130.00817.65
8.4.90.0090.01217.61
8.4.80.0120.00717.94
8.4.70.0120.00618.00
8.4.60.0140.00617.78
8.4.50.0120.00918.62
8.4.40.0080.00024.02
8.4.30.0040.01522.41
8.4.20.0120.00617.77
8.4.10.0150.00019.66
8.3.250.0140.00618.71
8.3.240.0110.01016.67
8.3.230.0130.00616.57
8.3.220.0080.01016.90
8.3.210.0050.00316.45
8.3.200.0110.00816.66
8.3.190.0100.01117.09
8.3.180.0110.00818.90
8.3.170.0150.00317.29
8.3.160.0190.00016.43
8.3.150.0090.00917.29
8.3.140.0150.00317.24
8.3.130.0050.00318.55
8.3.120.0080.00418.83
8.3.110.0040.00418.36
8.3.100.0090.00916.74
8.3.90.0030.00626.77
8.3.80.0030.00618.18
8.3.70.0130.00618.68
8.3.60.0070.00718.30
8.3.50.0130.00721.90
8.3.40.0100.00718.79
8.3.30.0120.00318.63
8.3.20.0000.00721.90
8.3.10.0000.00721.87
8.3.00.0050.00318.09
8.2.290.0110.00820.58
8.2.280.0100.00916.79
8.2.270.0060.01316.91
8.2.260.0030.00619.02
8.2.250.0080.00017.25
8.2.240.0130.00317.43
8.2.230.0030.01720.94
8.2.220.0120.00324.06
8.2.210.0110.00426.77
8.2.200.0100.00016.63
8.2.190.0160.00616.63
8.2.180.0040.01118.42
8.2.170.0070.00722.96
8.2.160.0070.00719.16
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0040.00422.13
8.2.120.0040.00426.35
8.2.110.0140.00420.47
8.2.100.0060.00618.22
8.2.90.0000.00819.05
8.2.80.0050.00317.97
8.2.70.0060.00317.75
8.2.60.0000.00818.16
8.2.50.0040.00418.10
8.2.40.0050.00322.27
8.2.30.0080.00021.03
8.2.20.0040.00417.79
8.2.10.0050.00318.05
8.2.00.0020.00517.99
8.1.330.0100.00916.88
8.1.320.0130.00616.38
8.1.310.0060.01218.57
8.1.300.0000.00816.26
8.1.290.0060.00330.84
8.1.280.0140.00425.92
8.1.270.0090.00022.19
8.1.260.0080.00028.09
8.1.250.0070.00028.09
8.1.240.0060.00322.19
8.1.230.0050.00519.54
8.1.220.0030.00517.74
8.1.210.0040.00418.77
8.1.200.0060.00317.23
8.1.190.0080.00017.23
8.1.180.0040.00418.10
8.1.170.0000.00818.59
8.1.160.0040.00422.01
8.1.150.0040.00418.90
8.1.140.0000.00719.49
8.1.130.0070.00017.62
8.1.120.0040.00417.54
8.1.110.0040.00417.54
8.1.100.0040.00417.52
8.1.90.0000.00817.39
8.1.80.0070.00017.37
8.1.70.0000.00817.35
8.1.60.0080.00017.60
8.1.50.0030.00517.54
8.1.40.0050.00317.51
8.1.30.0100.00017.53
8.1.20.0000.00917.68
8.1.10.0030.00517.48
8.1.00.0070.00017.55
8.0.300.0000.00718.77
8.0.290.0060.00316.88
8.0.280.0000.00718.52
8.0.270.0030.00617.38
8.0.260.0080.00017.25
8.0.250.0030.00316.98
8.0.240.0030.00316.90
8.0.230.0080.00016.98
8.0.220.0050.00216.88
8.0.210.0000.00816.84
8.0.200.0050.00316.89
8.0.190.0000.00717.05
8.0.180.0040.00417.01
8.0.170.0030.00516.96
8.0.160.0050.00216.96
8.0.150.0040.00416.98
8.0.140.0030.00316.92
8.0.130.0030.00313.43
8.0.120.0000.00817.02
8.0.110.0000.00717.00
8.0.100.0000.00716.79
8.0.90.0040.00416.97
8.0.80.0090.00616.99
8.0.70.0040.00416.95
8.0.60.0040.00416.94
8.0.50.0000.00716.92
8.0.30.0120.00617.11
8.0.20.0120.00817.43
8.0.10.0040.00417.08
8.0.00.0110.00616.84
7.4.330.0020.00215.14
7.4.320.0060.00016.45
7.4.300.0030.00316.62
7.4.290.0030.00616.43
7.4.280.0080.00016.60
7.4.270.0000.00716.61
7.4.260.0000.00716.59
7.4.250.0000.00716.50
7.4.240.0000.00716.57
7.4.230.0040.00416.43
7.4.220.0100.01016.64
7.4.210.0070.01316.48
7.4.200.0000.00716.55
7.4.160.0100.01016.57
7.4.150.0140.00717.40
7.4.140.0100.00917.86
7.4.130.0090.01016.60
7.4.120.0020.01516.51
7.4.110.0150.00616.59
7.4.100.0070.01416.59
7.4.90.0140.00316.64
7.4.80.0100.00719.39
7.4.70.0070.01016.68
7.4.60.0070.01016.50
7.4.50.0030.01016.65
7.4.40.0100.00716.68
7.4.30.0080.00816.48
7.3.330.0000.00513.50
7.3.320.0060.00013.26
7.3.310.0070.00016.39
7.3.300.0000.00716.47
7.3.290.0090.00516.44
7.3.280.0070.01216.42
7.3.270.0100.00717.40
7.3.260.0030.01516.61
7.3.250.0120.01116.41
7.3.240.0080.00916.60
7.3.230.0140.00316.50
7.3.210.0100.00616.50
7.3.200.0070.01016.44
7.3.190.0030.01316.63
7.3.180.0110.01016.48
7.3.170.0070.01116.46
7.3.160.0070.01416.51
7.2.330.0170.00316.94
7.2.320.0030.01316.77
7.2.310.0060.01116.43
7.2.300.0080.00816.45
7.2.290.0100.00716.72
7.1.00.0030.07722.44
7.0.90.0080.06819.93
7.0.80.0150.05719.94
7.0.70.0120.05319.97
7.0.60.0170.05520.10
7.0.50.0130.08220.27
7.0.40.0200.06720.31
7.0.30.0270.05320.30
7.0.20.0180.05820.27
7.0.10.0150.07820.32
7.0.00.0150.07320.29
5.6.240.0130.06320.59
5.6.230.0130.07020.61
5.6.220.0050.06720.57
5.6.210.0050.06820.74
5.6.200.0150.06321.12
5.6.190.0100.08021.09
5.6.180.0130.07021.11
5.6.170.0120.06321.08
5.6.160.0150.06321.11
5.6.150.0100.06721.09
5.6.140.0130.05721.09
5.6.130.0130.07321.09
5.6.120.0070.07221.05
5.6.110.0130.05821.12
5.6.100.0150.05521.07
5.6.90.0150.07221.07
5.6.80.0120.06520.50
5.6.70.0080.07020.45
5.6.60.0150.05520.46
5.6.50.0100.07320.48
5.6.40.0130.05320.40
5.6.30.0170.06520.49
5.6.20.0120.07220.45
5.6.10.0130.06020.42
5.6.00.0100.06020.43

preferences:
27.98 ms | 403 KiB | 5 Q