3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class BaseClass { } class MyClass extends BaseClass{ } $object = new MyClass(); echo is_subclass_of('BaseClass', 'BaseClass')? 'Yes<br />':'No<br />'; echo is_subclass_of('MyClass', 'BaseClass')? 'Yes<br />':'No<br />'; echo is_subclass_of('myclass', 'baseclass')? 'Yes<br />':'No<br />'; echo is_subclass_of('myClass', 'baseclass', false)? 'Yes<br />':'No<br />'; echo is_subclass_of($object, 'baseclass', false)? 'Yes<br />':'No<br />'; echo is_subclass_of($object, 'BaseClass')? 'Yes<br />':'No<br />';
Output for 5.3.9 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
No<br />Yes<br />Yes<br />No<br />Yes<br />Yes<br />
Output for 5.3.0 - 5.3.8
No<br />Yes<br />Yes<br /> Warning: is_subclass_of() expects exactly 2 parameters, 3 given in /in/agQVL on line 11 No<br /> Warning: is_subclass_of() expects exactly 2 parameters, 3 given in /in/agQVL on line 12 No<br />Yes<br />
Output for 5.0.3 - 5.2.17
No<br />Yes<br />Yes<br /> Warning: Wrong parameter count for is_subclass_of() in /in/agQVL on line 11 No<br /> Warning: Wrong parameter count for is_subclass_of() in /in/agQVL on line 12 No<br />Yes<br />
Output for 4.3.0 - 5.0.2
No<br />No<br />No<br /> Warning: Wrong parameter count for is_subclass_of() in /in/agQVL on line 11 No<br /> Warning: Wrong parameter count for is_subclass_of() in /in/agQVL on line 12 No<br />Yes<br />