note 104366 added to function.define
| From: | kobrasrealm at gmail dot com | Date: | Sat, 11 Jun 2011 01:31:46 +0000 |
| Subject: | note 104366 added to function.define | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-180430@lists.php.net to get a copy of this message | ||
When going back to rewrite code, it might be tempting to have a constant &reference a variable,
but it doesn't work.
<?php
header("Content-type: text/plain");
$variable = "value";
define("MYCONSTANT", &$variable);
echo $variable."\n";
echo MYCONSTANT."\n";
echo "------\n";
$variable = "different";
echo $variable."\n";
echo MYCONSTANT;
?>
Produces this:
value
value
------
different
value
I doubt it's supposed to work, either. :)
----
Server IP: 69.147.83.197
Probable Submitter: 132.170.36.39
----
Manual Page -- http://www.php.net/manual/en/function.define.php
Edit -- https://master.php.net/note/edit/104366
Del: integrated -- https://master.php.net/note/delete/104366/integrated
Del: useless -- https://master.php.net/note/delete/104366/useless
Del: bad code -- https://master.php.net/note/delete/104366/bad+code
Del: spam -- https://master.php.net/note/delete/104366/spam
Del: non-english -- https://master.php.net/note/delete/104366/non-english
Del: in docs -- https://master.php.net/note/delete/104366/in+docs
Del: other reasons-- https://master.php.net/note/delete/104366
Reject -- https://master.php.net/note/reject/104366
Search -- https://master.php.net/manage/user-notes.php