3v4l.org

run code in 300+ PHP versions simultaneously
<?php $count = 0; function p($x, &$count) { $count++; if ($x<= 2) { return 2; } else { return p($x-1)+p($x-2) -1; } } $b = p(5, $count); var_dump(p($b, $count)); echo $count;
Output for 7.1.0 - 7.1.20, 7.2.5 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
Fatal error: Uncaught ArgumentCountError: Too few arguments to function p(), 1 passed in /in/9muEP on line 10 and exactly 2 expected in /in/9muEP:5 Stack trace: #0 /in/9muEP(10): p(4) #1 /in/9muEP(14): p(5, 1) #2 {main} thrown in /in/9muEP on line 5
Process exited with code 255.
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Fatal error: Uncaught ArgumentCountError: Too few arguments to function p(), 1 passed in /in/9muEP on line 10 and exactly 2 expected in /in/9muEP:5 Stack trace: #0 /in/9muEP(10): p(4) #1 /in/9muEP(14): p(5, 1) #2 {main} thrown in /in/9muEP on line 5
Process exited with code 255.
Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20
Warning: Missing argument 2 for p(), called in /in/9muEP on line 10 and defined in /in/9muEP on line 5 Notice: Undefined variable: count in /in/9muEP on line 6 Warning: Missing argument 2 for p(), called in /in/9muEP on line 10 and defined in /in/9muEP on line 5 Notice: Undefined variable: count in /in/9muEP on line 6 Warning: Missing argument 2 for p(), called in /in/9muEP on line 10 and defined in /in/9muEP on line 5 Notice: Undefined variable: count in /in/9muEP on line 6 Warning: Missing argument 2 for p(), called in /in/9muEP on line 10 and defined in /in/9muEP on line 5 Notice: Undefined variable: count in /in/9muEP on line 6 Warning: Missing argument 2 for p(), called in /in/9muEP on line 10 and defined in /in/9muEP on line 5 Notice: Undefined variable: count in /in/9muEP on line 6 Warning: Missing argument 2 for p(), called in /in/9muEP on line 10 and defined in /in/9muEP on line 5 Notice: Undefined variable: count in /in/9muEP on line 6 Warning: Missing argument 2 for p(), called in /in/9muEP on line 10 and defined in /in/9muEP on line 5 Notice: Undefined variable: count in /in/9muEP on line 6 Warning: Missing argument 2 for p(), called in /in/9muEP on line 10 and defined in /in/9muEP on line 5 Notice: Undefined variable: count in /in/9muEP on line 6 Warning: Missing argument 2 for p(), called in /in/9muEP on line 10 and defined in /in/9muEP on line 5 Notice: Undefined variable: count in /in/9muEP on line 6 Warning: Missing argument 2 for p(), called in /in/9muEP on line 10 and defined in /in/9muEP on line 5 Notice: Undefined variable: count in /in/9muEP on line 6 Warning: Missing argument 2 for p(), called in /in/9muEP on line 10 and defined in /in/9muEP on line 5 Notice: Undefined variable: count in /in/9muEP on line 6 Warning: Missing argument 2 for p(), called in /in/9muEP on line 10 and defined in /in/9muEP on line 5 Notice: Undefined variable: count in /in/9muEP on line 6 Warning: Missing argument 2 for p(), called in /in/9muEP on line 10 and defined in /in/9muEP on line 5 Notice: Undefined variable: count in /in/9muEP on line 6 Warning: Missing argument 2 for p(), called in /in/9muEP on line 10 and defined in /in/9muEP on line 5 Notice: Undefined variable: count in /in/9muEP on line 6 Warning: Missing argument 2 for p(), called in /in/9muEP on line 10 and defined in /in/9muEP on line 5 Notice: Undefined variable: count in /in/9muEP on line 6 Warning: Missing argument 2 for p(), called in /in/9muEP on line 10 and defined in /in/9muEP on line 5 Notice: Undefined variable: count in /in/9muEP on line 6 Warning: Missing argument 2 for p(), called in /in/9muEP on line 10 and defined in /in/9muEP on line 5 Notice: Undefined variable: count in /in/9muEP on line 6 Warning: Missing argument 2 for p(), called in /in/9muEP on line 10 and defined in /in/9muEP on line 5 Notice: Undefined variable: count in /in/9muEP on line 6 Warning: Missing argument 2 for p(), called in /in/9muEP on line 10 and defined in /in/9muEP on line 5 Notice: Undefined variable: count in /in/9muEP on line 6 Warning: Missing argument 2 for p(), called in /in/9muEP on line 10 and defined in /in/9muEP on line 5 Notice: Undefined variable: count in /in/9muEP on line 6 Warning: Missing argument 2 for p(), called in /in/9muEP on line 10 and defined in /in/9muEP on line 5 Notice: Undefined variable: count in /in/9muEP on line 6 Warning: Missing argument 2 for p(), called in /in/9muEP on line 10 and defined in /in/9muEP on line 5 Notice: Undefined variable: count in /in/9muEP on line 6 int(9) 2

preferences:
166.15 ms | 410 KiB | 183 Q