Re: $x instanceof __CLASS__
| From: | Marcus Boerger | Date: | Tue, 27 Dec 2005 14:45:32 +0000 |
| Subject: | Re: $x instanceof __CLASS__ | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-21346@lists.php.net to get a copy of this message | ||
Hello Jochem,
right now it's by design, instanceof takes a T_STRING or a variable.
__CLASS__ returns a const string which is different form a T_STRING.
marcus
Tuesday, December 27, 2005, 3:30:48 PM, you wrote:
> hi there,
> a quick question regarding whether the following is by design,
> because it causes a parse error (the code I tried out did occur within
> a class definition ! :-):
> if (!$field instanceof __CLASS__) {
> // do something
> }
> where as this obviously does work:
> $class = __CLASS__;
> if (!$field instanceof $class) {
> // do something
> }
> as does this:
> if (!$field instanceof self) {
> // do something
> }
> rgds,
> jochem
Best regards,
Marcus