Johannes Schlüter wrote:
On Sat, 2009-12-19 at 01:42 +0100, Johannes Mueller wrote:
if($foo instanceof bar){
..
}
// runs without any notification
instanceof is a language construct expecting a class identifier.
It doesn't complain about on-existing classes as it would need to
trigger the
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)){
..
}
//
On Sat, 2009-12-19 at 01:42 +0100, Johannes Mueller wrote:
if($foo instanceof bar){
..
}
// runs without any notification
instanceof is a language construct expecting a class identifier.
It doesn't complain about on-existing classes as it would need to
trigger the __autoloader which might be
Johannes Mueller wrote:
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?
I think you meant:
if(is_a($foo, bar)){
since is_a() takes a string as
Johannes Schlüter schreef:
On Sat, 2009-12-19 at 01:42 +0100, Johannes Mueller wrote:
if($foo instanceof bar){
..
}
// runs without any notification
instanceof is a language construct expecting a class identifier.
It doesn't complain about on-existing classes as it would need to