note 7996 added to Arrays
| From: | Andy Zarzycki | Date: | Wed, 23 Aug 2000 19:03:43 +0000 |
| Subject: | note 7996 added to Arrays | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-3031@lists.php.net to get a copy of this message | ||
In reply to martin@hkhotmail.com:
In order to evaluate more complex variable expressions inside double quotes, you need to use curly
braces. They allow PHP to determine what to try to parse as the variable name, and what is the
remainder of the string.
<?php
$array1['tmp']='dummy';
$var2 = "${array1['tmp']}";
echo $var2;
?>
This gives:
dummy
You can also use curly braces to avoid ambiguities in variable names, especially when you do not
want spaces after the variable value.
<?php
$abc = "XYZ";
echo "$abcdef"; // writes nothing; $abcdef does not exist.
echo "${abc}def"; // writes "XYZdef"
?>
Hope that clears things up.
http://www.php.net/manual/language.types.array.php