3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo "start\n"; register_shutdown_function(function() { $err = error_get_last(); if ($err) { echo "Yes Error\n"; echo "Error is: ".print_r($err, True); } else { echo "No Error\n"; } echo "shutdown\n"; }); set_exception_handler(function($ex) { if ($ex instanceof Error) { echo "Exception Handler is Error\n"; return Null; } echo "Exception Handler\n"; die(); }); set_error_handler(function($errno, $errstr, $errfile, $errline, $errcontext) { echo "Error Handler: ".$errstr."\n"; echo "Error Type: ".$errno."\n"; die(); #throw new ErrorException("raising errorexception", 0, $errno, $errfile, $errline); }); class Foo { public function __construct() { $this->foo = 5; } public function foo() { if ($this->foo === 5) { echo "Called Foo.foo()\n"; } } public function other() { echo "Called Foo.other()\n"; } public function bad() { $not.there(); } } $foo = new Foo(); #$foo.bar(); #$fig.bar(); $foo.bad(); #$bar.foo(); #Foo::foo(); #Foo::other(); #$x = $y + 5; #$file=fopen("welcome.txt","r"); #echo $foo . "appending<br />"; #$t = I_AM_NOT_DEFINED; # #trigger_error("Triggered Error", E_USER_ERROR); #password_hash("swordfish", PASSWORD_BCRYPT, array("salt"=>"sjienvidndiwnsosvknsfoiwnlnvsoi")); echo "Continuing execution<br />";
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, 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
start Exception Handler is Error No Error shutdown
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 start Exception Handler is Error No Error shutdown
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
start Fatal error: Call to undefined function bad() in /in/v0CAR on line 57 Yes Error Error is: Array ( [type] => 1 [message] => Call to undefined function bad() [file] => /in/v0CAR [line] => 57 ) shutdown
Process exited with code 255.

preferences:
244.92 ms | 402 KiB | 327 Q