note 48555 deleted from language.operators by danbrown
| From: | danbrown@php.net | Date: | Fri, 30 Jan 2009 20:44:24 +0000 |
| Subject: | note 48555 deleted from language.operators by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-150008@lists.php.net to get a copy of this message | ||
Note Submitter: npeelman at cfl dot rr dot com
----
Update to message by yasuo_ohgaki at hotmail dot com:
I know this is an old message but when using an Associative array in a string you do not have to
use { and } to resolve ambiguity.
ex:
Associative Array in string:
$arr['item'] = 'string';
echo "This is {$arr['item']}"; //prints "This is string".
...does work but, so does:
echo "This is $arr[item]"; //prints "This is string".
... simply enclose the whole string with double quotes and leave out the single quotes from around
the index name. This simplifies the code and makes things easier to read.