note 126463 added to language.constants.syntax
| From: | LilyWhite at main dot php dot net | Date: | Wed, 29 Sep 2021 05:39:58 +0000 |
| Subject: | note 126463 added to language.constants.syntax | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-217013@lists.php.net to get a copy of this message | ||
> Constants and (global) variables are in a different namespace. This implies that for example
> true and $TRUE are generally different.
This means that you may assign a value to a variable with the same name of a constant, which might
lead to unwanted results.
<?php
const FOO = "hello";
$FOO = "goodbye";
echo $FOO;
?>
will output ``goodbye''.
----
Server IP: 45.112.84.4
Probable Submitter: 45.112.85.242 (proxied: 65.49.211.27)
----
Manual Page -- https://php.net/manual/en/language.constants.syntax.php
Edit -- https://main.php.net/note/edit/126463
Del: integrated -- https://main.php.net/note/delete/126463/integrated
Del: useless -- https://main.php.net/note/delete/126463/useless
Del: bad code -- https://main.php.net/note/delete/126463/bad+code
Del: spam -- https://main.php.net/note/delete/126463/spam
Del: non-english -- https://main.php.net/note/delete/126463/non-english
Del: in docs -- https://main.php.net/note/delete/126463/in+docs
Del: other reasons-- https://main.php.net/note/delete/126463
Reject -- https://main.php.net/note/reject/126463
Search -- https://main.php.net/manage/user-notes.php