3 ms·
If you wonder why PHP does this, I think it comes from our old friend register_globals. In the past, query string, request body and cookie values were automatic
by TazeTSchnitzel 7y ago
If you wonder why PHP does this, I think it comes from our old friend register_globals. In the past, query string, request body and cookie values were automatically made into global variables, so they needed to have variable-friendly names.
- meritt 7y agoCorrect, this behavior is well-known and has been around for 20+ years. Leading spaces are removed and additionally other spaces or dots are converted to an underscore. For this reason, many frameworks ignore the default $_GET structure and instead access the raw URI query in $_SERVER['QUERY_STRING'].