juno
juno

Reputation: 31

How to tell what class you extends?

Is there a function that tells what class you are extending? Like function_exists?

I want to use this in an __autoload function that if it detects a class that extends mysqli, then I will automatically connect it to the database.

Upvotes: 1

Views: 58

Answers (1)

meder omuraliev
meder omuraliev

Reputation: 186742

class foo { };
class bar extends foo {};
$bar = new bar();
echo get_parent_class($bar);

assuming bar extends foo, should echo foo

Upvotes: 2

Related Questions