note 48555 added to language.operators
| From: | npeelman at cfl dot rr dot com | Date: | Wed, 29 Dec 2004 11:22:19 +0000 |
| Subject: | note 48555 added to language.operators | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-82446@lists.php.net to get a copy of this message | ||
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.
----
Manual Page -- http://www.php.net/manual/en/language.operators.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+48555
Delete -- http://master.php.net/manage/user-notes.php?action=delete+48555&report=yes
Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+48555&report=yes&reason=bad+code
Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+48555&report=yes&reason=spam
Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+48555&report=yes&reason=useless+example
Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+48555&report=yes&reason=contains+commercial+links
Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+48555&report=yes&reason=useless+note
Reject -- http://master.php.net/manage/user-notes.php?action=reject+48555&report=yes
Search -- http://master.php.net/manage/user-notes.php