Closed
Description
Description
I just remembered this behavior when using parse_str()
, that dots and spaces in query string keys are replaced with underscore, for the reason that those aren't allowed in PHP variable names. From PHP 8 on the second argument $result
is mandatory, so I think it now doesn't create variables in any case, right? So to me, replacing those characters in the resulting array keys, seems like a leftover that could be removed?
Example:
<?php
parse_str('foo.bar =baz', $array);
var_dump($array);
Currently results in:
array(1) {
["foo_bar_"]=>
string(3) "baz"
}
Maybe better?
array(1) {
["foo.bar "]=>
string(3) "baz"
}
PHP Version
PHP 8
Operating System
No response