note 73828 added to function.define
| From: | user=fred68c at osu1 dot php dot net | Date: | Mon, 12 Mar 2007 12:31:41 +0000 |
| Subject: | note 73828 added to function.define | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-124372@lists.php.net to get a copy of this message | ||
Hello Alf
In this example,
<?php
$str = "test";
print $foo[$str];
?>
$foo[$str] will be translate to $foo[âtestâ] because $str is a string and output is then
âdebug 2â
If you want the constant test your code should be :
<?php
$str = "test";
print $foo[constant($str)];
?>
or
<?php
$str = test;
print $foo[$str];
?>
this output is now âdebug 1â
----
Server IP: 194.246.101.61
Probable Submitter: 82.237.162.76
----
Manual Page -- http://www.php.net/manual/en/function.define.php
Edit -- https://master.php.net/note/edit/73828
Del: integrated -- https://master.php.net/note/delete/73828/integrated
Del: useless -- https://master.php.net/note/delete/73828/useless
Del: bad code -- https://master.php.net/note/delete/73828/bad+code
Del: spam -- https://master.php.net/note/delete/73828/spam
Del: non-english -- https://master.php.net/note/delete/73828/non-english
Del: in docs -- https://master.php.net/note/delete/73828/in+docs
Del: other reasons-- https://master.php.net/note/delete/73828
Reject -- https://master.php.net/note/reject/73828
Search -- https://master.php.net/manage/user-notes.php