You are here: Re: $request problem « PHP Programming Language « IT news, forums, messages
Re: $request problem

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация