FAQ
Hi,

I have a general question in regard to the PHP variable normalizing. Obviously,
leading whitespace in a variable is stripped, but why is trailing whitespace
converted to underscores?

Example:

/?foo=bar&+fooo=blah&foooooo+=ljalskdf

results in:

array(3) {
["foo"]=>
string(3) "bar"
["fooo"]=>
string(4) "blah"
["foooooo_"]=>
string(8) "ljalskdf"
}

I can understand why one would want to convert middle spaces (like in "foo+bar")
to underscores, but shouldn't trailing spaces be stripped instead? Am I missing
something?

Regards,

--ck

Search Discussions

  • Pawel Bernat at Aug 8, 2005 at 2:11 pm

    On Mon, Aug 08, 2005 at 03:37:53PM +0200, Christopher Kunz wrote:
    Hi,

    I have a general question in regard to the PHP variable normalizing. Obviously,
    leading whitespace in a variable is stripped, but why is trailing whitespace
    converted to underscores?
    See http://php.net/manual/en/function.urldecode.php
    --
    Paweł Bernat; uselessness' lover;
    select'<asm'||chr(64)||'asm'||'.'||'flynet'||chr(46)||'pl>'as email;
    Slowly and surely the unix crept up on the Nintendo user ...
  • Derick Rethans at Aug 8, 2005 at 2:15 pm

    On Mon, 8 Aug 2005, Pawel Bernat wrote:
    On Mon, Aug 08, 2005 at 03:37:53PM +0200, Christopher Kunz wrote:
    Hi,

    I have a general question in regard to the PHP variable normalizing. Obviously,
    leading whitespace in a variable is stripped, but why is trailing whitespace
    converted to underscores?
    See http://php.net/manual/en/function.urldecode.php
    He's asking 'why' not 'how'...

    Derick
  • Christopher Kunz at Aug 8, 2005 at 10:12 pm
    He's asking 'why' not 'how'...
    Right. My suspicion is that this is from the old days, when men were men and GET
    variables were not in $_GET - but the inconsistency kinda bugs me. There has to
    be someone who remembers why they wrote it that way...?

    Anyone? Rasmus? :)

    --ck

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupphp-internals @
categoriesphp
postedAug 8, '05 at 1:45p
activeAug 8, '05 at 10:12p
posts4
users3
websitephp.net

People

Translate

site design / logo © 2022 Grokbase