3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php interface MyInterface { } class BaseClass implements MyInterface{ } class MyClass extends BaseClass{ } $object = new MyClass(); echo @is_subclass_of('BaseClass', 'BaseClass')? "Yes ":"No "; echo @is_subclass_of('MyClass', 'BaseClass')? "Yes ":"No "; echo @is_subclass_of('MyClass', 'MyInterface')? "Yes ":"No "; echo "\n"; echo @is_subclass_of($object, 'BaseClass')? "Yes ":"No "; echo @is_subclass_of($object, 'MyInterface')? "Yes ":"No "; $object2 = new myclass(); echo "\n"; echo @is_subclass_of($object2, 'BaseClass')? "Yes ":"No "; echo @is_subclass_of($object2, 'MyInterface')? "Yes ":"No ";
Output for 5.0.3 - 7.1.0
No Yes Yes Yes Yes Yes Yes
Output for 5.0.0 - 5.0.2
No No No Yes Yes Yes Yes
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING in /in/2ZeUa on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING in /in/2ZeUa on line 2
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/2ZeUa on line 2
Process exited with code 255.