Why . (dot) and space are changed to _ (underscores) in PHP $_GET array? [closed]

前提是你 提交于 2019-12-12 10:38:26

问题


In PHP documentation I found following part:

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

I'm aware that while PHP couldn't make variable $a.b for register_globals, but this explanation doesn't make me fully happy. While indeed, register_globals would have to do it (or, even if wouldn't have because of ${'a.b'}), but why it affected global variables like $_GET where technically you had to give string since beginning (so PHP programmers couldn't forgot about ${'a.b'} sort of stuff in case of $_GET).

And why it only affects dots and spaces? While I can understand dots (<input type=image>), why it would affect spaces. And what about hyphens?

来源:https://stackoverflow.com/questions/11084175/why-dot-and-space-are-changed-to-underscores-in-php-get-array

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!