Re: interesting
| From: | Daniel Clark | Date: | Tue, 25 May 2004 20:48:28 +0000 |
| Subject: | Re: interesting | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-186953@lists.php.net to get a copy of this message | ||
Good point Justin !
>>John W. Holmes wrote:
>>
>>> From: Daniel Clark
>>>
>>>
>>>>>echo "\"{$search_for_list[$i][0]}\""; will work, btw.
>>>>
>>>>What does the {}around the array mean?
>>>
>>>
>>> It delimits your variable so PHP knows what to interpret as a variable and
>>> what to interpret as a string.
>>>
>>> $ar[1] = 'foo';
>>> echo "Value is {$ar[1]}"; // Value is foo
>>>
>>> $ar = 'foo';
>>> echo "Value is {$ar}[1]"; //Value is foo[1]
>>> echo "Value is {$ar[1]}"; //Value is f
>>>
>>> echo "Hello {$name}, you are {$age} years old";
>>>
>>> etc...
>>>
>>> ---John Holmes...
>>
>>IMHO it's just better to use concatenation and single quotes for your
>>string. PHP doesn't have to parse your strings for variables that way
>>and it makes it obvious what parts are variables.
>>
>>--
>>paperCrane <Justin Patrin>