Re: Local constants
| From: | Eugene Sidelnyk | Date: | Wed, 04 Sep 2024 15:30:39 +0000 |
| Subject: | Re: Local constants | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-125417@lists.php.net to get a copy of this message | ||
> Hello internals!
>
> I was wondering, has there been any discussion about supporting local
> constants (variables that cannot be reassigned, perhaps even function
> parameters)?
>
As for me, I would've hoped that there were local constants in PHP and I'd
want to provide some thoughts on this regard.
In my opinion, I'd really love the following syntax:
a = 'the constant value';
I'm not sure if this would relate to the rest of PHP ecosystem, since there
are already
const/define keywords for ordinary constants and
readonly
for properties.
Nonetheless, in my opinion,
more concice syntax like a = '...'; would promote usage of local
constants instead of variables, which is generally better, being more
stricter, though being a huge change to PHP as well.
Best regards, Yevhen