You are here: Re: ["HTTP_POST"] versus ['HTTP_POST'] « PHP Programming Language « IT news, forums, messages
Re: ["HTTP_POST"] versus ['HTTP_POST']

Posted by joboils on 07/08/07 14:29

On Sat, 07 Jul 2007 11:55:00 +0300, Rami Elomaa
<rami.elomaa@gmail.com> wrote:

>joboils@hotmail.com kirjoitti:
>> I've inherited a huge, rambling site with numerous lines containing
>> $_SERVER["HTTP_POST"]
>> php.net says it should be single inverted commas, not double, yet
>> everything seems to work. As it would be a considerable amount of
>> work to change everything, can I safely leave things as they are?
>> TIA.
>
>I'm sure you've misinterpreted the manual. The syntax above, with double
>quotes is prefectly fine. All it does is that it delimits a string
>literal, for this puropuse double quotes and single quotes are just
>fine. The reason single quotes is _preferred_ (but not required) is that
>in this case it's slightly faster. You see, double quoted strings may
>containt php variables that are replaced with the string values of the
>variables. Single quoted strings do not have this quality, and that is
>the reason they work a little bit faster than double quoted strings.
>
>But like the wise man said: if it works, don't fix it. You can leave it
>just like that and be cool with it. I'm sure the possible improvement in
>performance that you'd gain from changing each double quote to single
>quote is nominal, you'll do nothing but waste your time.
>
>Finally a little example to demonstrate the difference.
><?php
>
>$cat = "Garfield";
>
>echo "That $cat is so funny!"; // Double quotes
>// This will print: That Garfield is so funny!
>// $cat is changed into its value.
>
>echo 'That $cat is so funny!'; // Single Quotes
>// This will print: That $cat is so funny!
>// No changes are made, printed literally as it's written.

Thanx to both of you.

 

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

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