note 51723 added to function.define
| From: | dsan at pml dot ac dot uk | Date: | Fri, 08 Apr 2005 15:17:20 +0000 |
| Subject: | note 51723 added to function.define | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-87704@lists.php.net to get a copy of this message | ||
Just to clarify what 'david at nospam webgroup dot org' said:
${} is actually the syntax for 'variable variables'.
So in this specific case:
Starting with the line:
${MY_CONST} = serialize(array('foo' => 'bar'));
PHP will expand the constant and use it as the name of the variable:
$test = serialize(array('foo' => 'bar'));
So in fact there is no assignment to a constant (which would defy the definition of
'constant') but instead an assignment to a variable named by the _value_ of the constant.
----
Manual Page -- http://www.php.net/manual/en/function.define.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+51723
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+51723&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+51723&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+51723&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+51723&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+51723&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+51723&report=yes
Search -- http://master.php.net/manage/user-notes.php