Re: Constants in double-quoted strings
| From: | Dave Ingram | Date: | Wed, 29 Oct 2008 14:47:43 +0000 |
| Subject: | Re: Constants in double-quoted strings | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-41556@lists.php.net to get a copy of this message | ||
Josh wrote:
> Dave, how is a variable name any less a bareword than a constant name?
>
A bareword (in my opinion) is a word without a sigil (e.g. a leading $),
so the way that you would write a constant normally in PHP. What I was
trying to say is that having bareword-style interpolation ("{MYCONST}")
is much more likely to break BC than the "{#MYCONST}" style.
> Thats what the backets were for, perhaps combined with a symbol to
> make it even less likely, and of course if the constant is not found
> in the symbol table, the constant name would be outputted directly.
>
But would it raise a warning, as PHP currently does for unrecognised
constants? If not, it could be argued that this would make subtle typos
harder to spot.
Dave