is_a() against instanceof

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

 



Hi,

PHP5 uses the 'instanceof' keyword instead of the deprecated is_a() function.
But there's a big difference between the two:
- is_a($cls,"ClassName") *doesn't require* from ClassName to be declared, and return false when ClassName is not declared.
- ($cls instanceof ClassName) *requires* from ClassName to be declared, and generates a fatal error when ClassName is not declared.


Since is_a() is deprecated.. is there a way to use instanceof exactly like is_a() function (so it will not make an error when the class is not declared)?

-thanks, Eli

--
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