note 73828 deleted from function.define by tularis
| From: | tularis@php.net | Date: | Sun, 03 Jun 2007 09:36:49 +0000 |
| Subject: | note 73828 deleted from function.define by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-127139@lists.php.net to get a copy of this message | ||
Note Submitter: user=fred68c, domain=free.fr
----
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â