3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Sample; var_dump(is_resource(STDOUT)); function f1($f) { fwrite($f, "1 called!\n"); } function f2(\resource $f) { fwrite($f, "2 called!\n"); } function f3(resource $f) { fwrite($f, "3 called!\n"); } f1(STDOUT); f2(STDOUT); f3(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
Warning: "resource" is not a supported builtin type and will be interpreted as a class name. Write "\Sample\resource" or import the class with "use" to suppress this warning in /in/RsOEK on line 15 bool(true) 1 called! Fatal error: Uncaught TypeError: Sample\f2(): Argument #1 ($f) must be of type resource, resource given, called in /in/RsOEK on line 20 and defined in /in/RsOEK:11 Stack trace: #0 /in/RsOEK(20): Sample\f2(Resource id #2) #1 {main} thrown in /in/RsOEK on line 11
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 Warning: "resource" is not a supported builtin type and will be interpreted as a class name. Write "\Sample\resource" or import the class with "use" to suppress this warning in /in/RsOEK on line 15 bool(true) 1 called! Fatal error: Uncaught TypeError: Sample\f2(): Argument #1 ($f) must be of type resource, resource given, called in /in/RsOEK on line 20 and defined in /in/RsOEK:11 Stack trace: #0 /in/RsOEK(20): Sample\f2(Resource id #2) #1 {main} thrown in /in/RsOEK on line 11
Process exited with code 255.
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
bool(true) 1 called! Fatal error: Uncaught TypeError: Argument 1 passed to Sample\f2() must be an instance of resource, resource given, called in /in/RsOEK on line 20 and defined in /in/RsOEK:11 Stack trace: #0 /in/RsOEK(20): Sample\f2(Resource id #2) #1 {main} thrown in /in/RsOEK on line 11
Process exited with code 255.
Output for 5.6.0 - 5.6.40
bool(true) 1 called! Catchable fatal error: Argument 1 passed to Sample\f2() must be an instance of resource, resource given, called in /in/RsOEK on line 20 and defined in /in/RsOEK on line 11
Process exited with code 255.

preferences:
241.53 ms | 401 KiB | 291 Q