3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo ($a = 10, $b){ if ($a) { return $b/10; } } echo foo(0);
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Deprecated: Optional parameter $a declared before required parameter $b is implicitly treated as a required parameter in /in/Vt58g on line 2 Fatal error: Uncaught ArgumentCountError: Too few arguments to function foo(), 1 passed in /in/Vt58g on line 7 and exactly 2 expected in /in/Vt58g:2 Stack trace: #0 /in/Vt58g(7): foo(0) #1 {main} thrown in /in/Vt58g on line 2
Process exited with code 255.
Output for 8.0.0 - 8.0.30
Deprecated: Required parameter $b follows optional parameter $a in /in/Vt58g on line 2 Fatal error: Uncaught ArgumentCountError: Too few arguments to function foo(), 1 passed in /in/Vt58g on line 7 and exactly 2 expected in /in/Vt58g:2 Stack trace: #0 /in/Vt58g(7): foo(0) #1 {main} thrown in /in/Vt58g on line 2
Process exited with code 255.
Output for 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.12 - 7.3.33, 7.4.0 - 7.4.33
Fatal error: Uncaught ArgumentCountError: Too few arguments to function foo(), 1 passed in /in/Vt58g on line 7 and exactly 2 expected in /in/Vt58g:2 Stack trace: #0 /in/Vt58g(7): foo(0) #1 {main} thrown in /in/Vt58g on line 2
Process exited with code 255.
Output for 5.5.31 - 5.5.38, 5.6.17 - 5.6.28, 7.0.0 - 7.0.20
Warning: Missing argument 2 for foo(), called in /in/Vt58g on line 7 and defined in /in/Vt58g on line 2

preferences:
158.19 ms | 402 KiB | 179 Q