3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Sample; function f1($f) { fwrite($f, "1 called!\n"); } function f2(\resource $f) { fwrite($f, "2 called!\n"); } f1(STDOUT); f2(STDOUT);
Output for 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
1 called! Fatal error: Uncaught TypeError: Sample\f2(): Argument #1 ($f) must be of type resource, resource given, called in /in/HVvKr on line 14 and defined in /in/HVvKr:9 Stack trace: #0 /in/HVvKr(14): Sample\f2(Resource id #2) #1 {main} thrown in /in/HVvKr on line 9
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 1 called! Fatal error: Uncaught TypeError: Sample\f2(): Argument #1 ($f) must be of type resource, resource given, called in /in/HVvKr on line 14 and defined in /in/HVvKr:9 Stack trace: #0 /in/HVvKr(14): Sample\f2(Resource id #2) #1 {main} thrown in /in/HVvKr on line 9
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.6 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33
1 called! Fatal error: Uncaught TypeError: Argument 1 passed to Sample\f2() must be an instance of resource, resource given, called in /in/HVvKr on line 14 and defined in /in/HVvKr:9 Stack trace: #0 /in/HVvKr(14): Sample\f2(Resource id #2) #1 {main} thrown in /in/HVvKr on line 9
Process exited with code 255.

preferences:
159.04 ms | 403 KiB | 172 Q