note 44281 deleted from language.types.string by colder
| From: | colder@php.net | Date: | Tue, 17 Oct 2006 18:14:25 +0000 |
| Subject: | note 44281 deleted from language.types.string by colder | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-118642@lists.php.net to get a copy of this message | ||
Note Submitter: skippy zuavra net
----
The short version for the curly syntax:
1. $str{something} is the equivalent of $str[something]
2. Inside "" strings you can use any variable, no matter how complex the addressing mode
(multiple index array, imbricated objects) by enclosing the variable in {}:
"foo{$any_variable}bar".
To add to the confusion:
a) The two uses above have nothing in common, conceptually. For instance, #1 can use operations or
functions as that something, #2 is restricted to just variables.
b) In #2, you can use either ${ or {$ to open the curly expression ie. "${var}" and
"{$var}" are equivalent.