3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * @param int $num1 * @param ?int $num2 If null or omitted, it will get the value 1 * * @return int */ function add($num1, $num2 = null) { // If the default value is null, set it to the default $num2 = $num2 ?? 1; print_r($num1, $num2); return $num1 + $num2; } $bool = true; echo add(5, $bool ? 5 : null) . PHP_EOL; $bool = false; echo add(5, $bool ? 5 : null) . 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.5.00.0150.00619.79
8.4.150.0020.00014.05
8.4.140.0130.00817.62
8.4.130.0080.01017.79
8.4.120.0140.00620.52
8.4.110.0120.00922.33
8.4.100.0120.00517.76
8.4.90.0150.00718.76
8.4.80.0120.00917.90
8.4.70.0090.01017.78
8.4.60.0120.00818.79
8.4.50.0110.00919.58
8.4.40.0130.00617.56
8.4.30.0090.00920.44
8.4.20.0100.01017.76
8.4.10.0040.00421.73
8.3.280.0130.00818.32
8.3.270.0150.00516.41
8.3.260.0100.00716.40
8.3.250.0120.00619.17
8.3.240.0110.00816.66
8.3.230.0100.00716.58
8.3.220.0110.00417.18
8.3.210.0100.00516.52
8.3.200.0040.00516.73
8.3.190.0130.00616.97
8.3.180.0120.00618.58
8.3.170.0060.01217.14
8.3.160.0130.00616.51
8.3.150.0110.00720.72
8.3.140.0140.00418.90
8.3.130.0050.00318.28
8.3.120.0050.00518.87
8.3.110.0080.00016.62
8.3.100.0030.00718.09
8.3.90.0090.00926.77
8.3.80.0090.00019.36
8.3.70.0150.00616.49
8.3.60.0090.00920.20
8.3.50.0110.00716.46
8.3.40.0170.00320.30
8.3.30.0070.00720.34
8.3.20.0000.00824.18
8.3.10.0040.00424.66
8.3.00.0000.00726.16
8.2.290.0050.00320.38
8.2.280.0080.01018.25
8.2.270.0090.00917.28
8.2.260.0050.00322.47
8.2.250.0070.00318.32
8.2.240.0000.00818.27
8.2.230.0030.00620.94
8.2.220.0070.00024.06
8.2.210.0130.00626.77
8.2.200.0060.00318.88
8.2.190.0080.00818.16
8.2.180.0140.00718.30
8.2.170.0100.00718.92
8.2.160.0140.00422.96
8.2.150.0070.00025.66
8.2.140.0070.00024.66
8.2.130.0080.00026.16
8.2.120.0040.00421.07
8.2.110.0100.00021.18
8.2.100.0040.00817.66
8.2.90.0030.00518.03
8.2.80.0030.00518.95
8.2.70.0160.00379.33
8.2.60.0080.01179.33
8.2.50.0140.00479.33
8.2.40.0100.00779.33
8.2.30.0070.01079.33
8.2.20.0070.01079.33
8.2.10.0140.00379.33
8.2.00.0100.00779.33
8.1.330.0100.00823.68
8.1.320.0120.00715.93
8.1.310.0060.00316.44
8.1.300.0110.00420.01
8.1.290.0030.00630.84
8.1.280.0000.01825.92
8.1.270.0080.00024.66
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0040.00422.12
8.1.230.0030.00920.91
8.1.220.0050.00317.74
8.1.210.0050.00318.77
8.1.200.0150.00679.33
8.1.190.0160.00379.33
8.1.180.0080.00879.33
8.1.170.0140.00479.33
8.1.160.0120.00379.33
8.1.150.0090.00979.33
8.1.140.0060.01079.33
8.1.130.0050.01079.33
8.1.120.0100.00579.33
8.1.110.0130.00479.33
8.1.100.0130.00479.33
8.1.90.0090.00979.33
8.1.80.0110.00679.33
8.1.70.0110.00579.33
8.1.60.0100.00779.33
8.1.50.0130.00479.33
8.1.40.0180.00079.33
8.1.30.0110.00779.33
8.1.20.0090.00979.33
8.1.10.0130.00479.33
8.1.00.0140.00379.33
8.0.300.0000.00720.16
8.0.290.0110.00679.33
8.0.280.0170.00079.33
8.0.270.0080.00879.33
8.0.260.0130.00379.33
8.0.250.0090.00779.33
8.0.240.0120.00479.33
8.0.230.0110.00679.33
8.0.220.0080.00879.33
8.0.210.0070.01079.33
8.0.200.0180.00479.33
8.0.190.0180.00079.33
8.0.180.0140.00379.33
8.0.170.0080.00879.33
8.0.160.0110.00879.33
8.0.150.0090.00779.33
8.0.140.0130.00379.33
8.0.130.0130.00379.33
8.0.120.0060.01079.33
8.0.110.0130.00079.33
8.0.100.0140.00379.33
8.0.90.0050.01179.33
8.0.80.0120.00479.33
8.0.70.0160.00279.33
8.0.60.0120.00479.33
8.0.50.0130.00379.33
8.0.30.0120.00379.33
8.0.20.0100.00579.33
8.0.10.0120.00379.33

preferences:
106.3 ms | 403 KiB | 5 Q