is_a() versus instanceof
| From: | Johannes Mueller | Date: | Sat, 19 Dec 2009 00:42:00 +0000 |
| Subject: | is_a() versus instanceof | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-46470@lists.php.net to get a copy of this message | ||
Hi,
is it intended to have different behaviours of is_a() and instanceof?
Let's assume you have the following code snippets:
class foo{}
class baz{} //<-you have a typo here, want to write bar
if($foo instanceof bar){
..
}
// runs without any notification
and
if(is_a($foo, bar)){
..
}
// runs with an undefined constant bar notification
I think the instanceof solution can cause problems, because you can not trigger the problem. What do you think?
Johannes