tags:

views:

29

answers:

1

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.

If there is a better way to do this then I will appreciate it.

Thanks!

+2  A: 
class foo { };
class bar extends foo {};
$bar = new bar();
echo get_parent_class($bar);

assuming bar extends foo, should echo foo

meder
uhm... `$bar` is undefined, don't you mean `$foo`? get_parent_class: http://ca.php.net/manual/en/function.get-parent-class.php
Mark
Hey that was fast! Thanks!
juno