note 126869 deleted from language.oop5.constants by cmb
| From: | cmb@php.net | Date: | Tue, 22 Feb 2022 09:58:12 +0000 |
| Subject: | note 126869 deleted from language.oop5.constants by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-217640@lists.php.net to get a copy of this message | ||
Note Submitter: Patanjali
----
To keenskelly at gmail dot com:
'Re: "The value must be a constant expression, not (for example) a variable, a property, a
result of a mathematical operation, or a function call."'
All those cited examples are dependent upon runtime outcomes which are not available during the PHP
code-scanning process, whereas constant values are assigned then and so are available.
Note that a property/variable and its value is tokenised at this time, but not assigned as that
occurs at runtime, making that value unavailable for use during the remainder of the scan.
And cascading constant references are allowed just like with C's #define, as they are constant
expressions, being totally composed of constants -- literal or named -- that are available during
the sequential scanning of the PHP code.