|
Posted by ColdShine on 03/11/06 16:28
Jerry Stuckle in news:WvadnQQMO-tzxI_ZRVn-gw@comcast.com wrote:
> Norman Peelman wrote:
>
>> echo "<p>Search words: $_REQUEST[input]";
>>
>> is (one of) the correct ways. Single quotes aren't needed/don't work when
>> the variable is enclosed in double quotes. Unless you enclose the
>> variable in curly braces:
>>
>> echo "<p>Search words: {$_REQUEST['input']}";
>>
>> will work properly too...
>
> Yes, if you turn on all errors you will get an E_NOTICE because the
> string is not quoted.
No E_NOTICE at all.
http://www.php.net/manual/en/language.types.string.php#language.types.string.parsing.complex
There's no clear example stating this, but:
echo "$array[key]";
Is EXACTLY the same as:
echo "{$array['key']}";
With no notices being generated (I know since I always debug using E_ALL).
It's probably faster too, since I guess { "activates" a more complex parser.
Of course, that's the same as:
echo $array['key'];
--
ColdShine
"Experience is a hard teacher: she gives the test first, the lesson
afterwards." - Vernon Sanders law
Navigation:
[Reply to this message]
|