note 126869 added to language.oop5.constants
| From: | Patanjali at main dot php dot net | Date: | Tue, 22 Feb 2022 05:38:14 +0000 |
| Subject: | note 126869 added to language.oop5.constants | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-217638@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.135 (proxied: 193.119.55.47)
----
Manual Page -- https://php.net/manual/en/language.oop5.constants.php
Edit -- https://main.php.net/note/edit/126869
Del: integrated -- https://main.php.net/note/delete/126869/integrated
Del: useless -- https://main.php.net/note/delete/126869/useless
Del: bad code -- https://main.php.net/note/delete/126869/bad+code
Del: spam -- https://main.php.net/note/delete/126869/spam
Del: non-english -- https://main.php.net/note/delete/126869/non-english
Del: in docs -- https://main.php.net/note/delete/126869/in+docs
Del: other reasons-- https://main.php.net/note/delete/126869
Reject -- https://main.php.net/note/reject/126869
Search -- https://main.php.net/manage/user-notes.php