Re: Re: is_a() against instanceof
| From: | Marek Kilimajer | Date: | Mon, 21 Mar 2005 00:46:44 +0000 |
| Subject: | Re: Re: is_a() against instanceof | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-211158@lists.php.net to get a copy of this message | ||
Jason Barnett wrote:
Christian Stadler wrote:The only difference between && and AND is precedence, so the second statement won't be executed with either one.Eli schrieb:Nice suggestion! But I wonder... would it perhaps be better to use the && operator instead of the AND operator? That way in case you are trying to do an assignment PHP won't bother to check instanceof if the class_exists() fails. if (class_exists($class) && $cls instanceof $class) { }How about if (class_exists('ClassName') AND $cls instanceof ClassName) { ... } Regards, Christian Stadler- ($cls instanceof ClassName) *requires* from ClassName to be declared, and generates a fatal error when ClassName is not declared.