3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php set_error_handler('myerrorhandler'); set_exception_handler('myexceptionhandler'); function myfunc(stdClass $a) {} function myerrorhandler($errno, $errstr, $errfile, $errline, $errcontext) { echo "Error handler\n$errno\n$errstr\n"; } function myexceptionhandler($e) { echo "Exception handler\n";var_dump($e); } myfunc('iamnotaclass');
based on GdYhX
Output for 7.0.0 - 7.2.0
Exception handler object(TypeError)#1 (7) { ["message":protected]=> string(107) "Argument 1 passed to myfunc() must be an instance of stdClass, string given, called in /in/MOJuD on line 12" ["string":"Error":private]=> string(0) "" ["code":protected]=> int(0) ["file":protected]=> string(9) "/in/MOJuD" ["line":protected]=> int(4) ["trace":"Error":private]=> array(1) { [0]=> array(4) { ["file"]=> string(9) "/in/MOJuD" ["line"]=> int(12) ["function"]=> string(6) "myfunc" ["args"]=> array(1) { [0]=> string(12) "iamnotaclass" } } } ["previous":"Error":private]=> NULL }
Output for 5.3.20 - 5.6.28
Error handler 4096 Argument 1 passed to myfunc() must be an instance of stdClass, string given, called in /in/MOJuD on line 12 and defined