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_get_last\n"; echo "Error is: ".print_r($err, True); } else { echo "No error_get_last\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($ii) { $this->internal = $ii; } public function foo1() { if ($this->internal === 5) { echo "Called Foo->foo1()\n"; } } } $exists = new Foo(5); #$exists->foo1(); #$exists->doesnotexist(); #doesnotexist(); #$doesnotexist->alsodoesnotexist(); #Foo::foo1(); $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\n";

preferences:
54.15 ms | 402 KiB | 5 Q