Re: is_a() against instanceof

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jason Barnett wrote:
Eli wrote:
...

- is_a($cls,"ClassName")  *doesn't require* from ClassName to be
declared, and return false when ClassName is not declared.

...

Try is_subclass_of()

http://php.net/manual/en/function.is-subclass-of.php

is_subclass_of() is not exactly like is_a(), in that it will return false if the object is exactly from the class.

$cls=new ClassName();
var_dump(is_subclass_of($cls,"ClassName"));  //dumps: FALSE!
var_dump(is_a($cls,"ClassName"));  //dumps: TRUE!

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux