Dots and spaces in variable names are converted to underscores. For
example <input name="a.b" /> becomes $_POST["a_b"].

Any reason why? and any way to modify this behaviour to preserve dots
and spaces? (dots specifically)

I'm also using dots for this reason, so I feel your pain. What I ended up doing is converting dot syntax to PHP array syntax as I compile my templates. So when I type this: <input ... name="a.b.c.d"> what I get actually compiled and sent to the browser is this: <intput ... name="a[b][c][d]">

The reason for this quirk is register_globals. The symbols not suitable for symbol names, such as dots, are replaced with underscores, so that you can access your POST variable "foo.bar" as $foo_bar in global space. Of course it never made sense the conversion is applied to the superglobals like $_COOKIE/GET/POST, but it was, and now there are claims that it'll break backwards compatibility if changed.

I hope PHP6 will remove this processing as register_globals will be completely removed at that point.

Regards,
Stan Vassilev


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to