3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $var = 1; try { $var->method(); // Throws an Error object in PHP 7. } catch (Error $e) { // Handle error var_dump('error', $e); } catch (Exception $e) { // Handle error var_dump('exception', $e); } ?>
Output for 7.0.0 - 7.2.0
string(5) "error" object(Error)#1 (7) { ["message":protected]=> string(45) "Call to a member function method() on integer" ["string":"Error":private]=> string(0) "" ["code":protected]=> int(0) ["file":protected]=> string(9) "/in/qPmEj" ["line":protected]=> int(5) ["trace":"Error":private]=> array(0) { } ["previous":"Error":private]=> NULL }
Output for 5.6.8 - 5.6.28
Fatal error: Call to a member function method() on integer in /in/qPmEj on line 5
Process exited with code 255.
Output for 5.3.20 - 5.5.35
Fatal error: Call to a member function method() on a non-object in /in/qPmEj on line 5
Process exited with code 255.