Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #14465

Re: $-sign in form input names?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news2.arglkargh.de!news.mixmin.net!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From "Christoph M. Becker" <cmbecker69@arcor.de>
Newsgroups comp.lang.php
Subject Re: $-sign in form input names?
Date Tue, 04 Nov 2014 21:42:32 +0100
Organization solani.org
Lines 36
Message-ID <m3bdnm$qjg$1@solani.org> (permalink)
References <996e3930-f711-4338-9093-07115af47380@googlegroups.com> <m398il$m28$1@dont-email.me> <cbr824Fmk87U1@mid.individual.net> <m3a5jf$7tf$1@solani.org> <m3ange$3mv$1@dont-email.me>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 7bit
X-Trace solani.org 1415133750 27248 eJwVw4ENACEIA8CVeIEC41Rj9x/B/CWXjg+nAolIpZrC3D3VKv4tdbnSOObtNqW9nGejjQx/JmMROg== (4 Nov 2014 20:42:30 GMT)
X-Complaints-To abuse@news.solani.org
NNTP-Posting-Date Tue, 4 Nov 2014 20:42:30 +0000 (UTC)
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0
X-User-ID eJwNyMkBwCAIBMCWwrEg5Ygu/Zdg5jmwkDjpgXAMxvkZO4Fl958dZ8S3FOmjuYx5r5RK2zBK+wEYDREN
In-Reply-To <m3ange$3mv$1@dont-email.me>
Cancel-Lock sha1:Np7LN+4VHLXdCqk2Xo5HBYktkqw=
X-NNTP-Posting-Host eJwNw4ENACEIA8CVLEKBcQTe/UfwLznbBNuVRrVrd/lkeDQY2IWDJM+/l0nPlAylPD9BaqroAwT1EB8=
Xref csiph.com comp.lang.php:14465

Show key headers only | View raw


Jerry Stuckle wrote:

> On 11/4/2014 4:17 AM, Christoph M. Becker wrote:
>> J.O. Aho wrote:
>>
>>> As the double quotes will make the string to be parsed every time, which
>>> causes some slight overhead.
>>
>> But see
>> <http://nikic.github.io/2012/01/09/Disproving-the-Single-Quotes-Performance-Myth.html>.
> 
> I could go on, but the bottom line is - he is obviously biased, and his
> arguments are full of holes.  I agree with J.O. - single quotes are
> better unless you need to parse the strings.

Obviously you have not really understood the issue -- and neither has
J.O.  A double quoted string is "parsed" (actually, lexed) only *once*.
 A single quoted string is also lexed once.  So only the lexing time
could make a difference (and even this could be ignored when some kind
of bytecode cache is available; OPcache is enabled by default since PHP
5.5.0).

Anyhow, even a single quoted string has to be scanned for escapes ('\\',
'\''), so there is presumably not much difference (if we ignore
interpolation, what is not available for single quoted strings, anyway).
 Nikita's quick benchmark confirms this presumption.  A more thorough
measurement is left to the unbelieving reader.

It should be noted that this behavior does not apply to old PHP
versions, see
<http://blog.golemon.com/2006/06/how-long-is-piece-of-string.html>.

BTW: I rarely use double quoted strings.

-- 
Christoph M. Becker

Back to comp.lang.php | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

$-sign in form input names? sonnichjensen@gmail.com - 2014-11-03 07:23 -0800
  Re: $-sign in form input names? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-11-03 15:54 +0000
  Re: $-sign in form input names? Denis McMahon <denismfmcmahon@gmail.com> - 2014-11-04 01:02 +0000
    Re: $-sign in form input names? "J.O. Aho" <user@example.net> - 2014-11-04 06:55 +0100
      Re: $-sign in form input names? "Christoph M. Becker" <cmbecker69@arcor.de> - 2014-11-04 10:17 +0100
        Re: $-sign in form input names? Jerry Stuckle <jstucklex@attglobal.net> - 2014-11-04 09:23 -0500
          Re: $-sign in form input names? gordonb.2w35u@burditt.org (Gordon Burditt) - 2014-11-04 09:35 -0600
            Re: $-sign in form input names? Jerry Stuckle <jstucklex@attglobal.net> - 2014-11-04 10:37 -0500
          Re: $-sign in form input names? "Christoph M. Becker" <cmbecker69@arcor.de> - 2014-11-04 21:42 +0100
            Re: $-sign in form input names? Jerry Stuckle <jstucklex@attglobal.net> - 2014-11-04 17:01 -0500
              Re: $-sign in form input names? "Christoph M. Becker" <cmbecker69@arcor.de> - 2014-11-04 23:46 +0100
                Re: $-sign in form input names? Jerry Stuckle <jstucklex@attglobal.net> - 2014-11-04 21:19 -0500
        Re: $-sign in form input names? Matthew Carter <m@ahungry.com> - 2014-11-04 09:31 -0500

csiph-web