I want to check if a class is a subclass of another without creating an instance. I have a class that receives as a parameter a class name, and as a part of the validation process, I want to check if it’s of a specific class family (to prevent security issues and such). Any good way of doing this?
Share
is_subclass_of()will correctly check if a class extends another class, but will not returntrueif the two parameters are the same (is_subclass_of('Foo', 'Foo')will befalse).A simple equality check will add the functionality you require.