Re: [PHP-DEV] is_a() versus instanceof

2009-12-19 Thread Johannes Mueller
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

[PHP-DEV] is_a() versus instanceof

2009-12-18 Thread Johannes Mueller
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)){ .. } //

Re: [PHP-DEV] is_a() versus instanceof

2009-12-18 Thread Johannes Schlüter
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

Re: [PHP-DEV] is_a() versus instanceof

2009-12-18 Thread Christopher Jones
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

Re: [PHP-DEV] is_a() versus instanceof

2009-12-18 Thread Jille Timmermans
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