3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function acceptsObject(\stdClass $o) { var_dump(get_class($o)); } $anonymousObject = new \stdClass(); acceptsObject($anonymousObject); acceptsObject(new DOMDocument());
based on YuD2G
Output for 7.0.0 - 7.2.0
string(8) "stdClass" Fatal error: Uncaught TypeError: Argument 1 passed to acceptsObject() must be an instance of stdClass, instance of DOMDocument given, called in /in/V8nfX on line 10 and defined in /in/V8nfX:3 Stack trace: #0 /in/V8nfX(10): acceptsObject(Object(DOMDocument)) #1 {main} thrown in /in/V8nfX on line 3
Process exited with code 255.
Output for 5.3.20 - 5.6.28
string(8) "stdClass" Catchable fatal error: Argument 1 passed to acceptsObject() must be an instance of stdClass, instance of DOMDocument given, called in /in/V8nfX on line 10 and defined in /in/V8nfX on line 3
Process exited with code 255.