# GET/POST whitespace stripping behavior

- Thread: https://externals.io/message/17606
- Original archive: https://news-web.php.net/php.internals/17606
- Started by Christopher Kunz on 2005-08-08T13:37:53+00:00
- Messages: 3
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #17606 — Christopher Kunz — 2005-08-08T13:37:53+00:00

URL: https://externals.io/message/17606#17606

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

---

## #17611 — Derick Rethans — 2005-08-08T14:15:03+00:00

URL: https://externals.io/message/17606#17611

> 
> > […]
> See http://php.net/manual/en/function.urldecode.php

He's asking 'why' not 'how'...

Derick

-- 
Derick Rethans
http://derickrethans.nl | http://ez.no | http://xdebug.org

---

## #17639 — Christopher Kunz — 2005-08-08T22:12:16+00:00

URL: https://externals.io/message/17606#17639 · In reply to: #17611

> 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
