What for. (period) and space change to _ (underscore) in PHP $ _GET array?

In the PHP documentation, I found the following part:

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

I know that although PHP could not make the $ab variable for register_globals , but this explanation does not make me completely happy. Although, indeed, register_globals would have to do this (or even if it weren’t because of ${'a.b'} ), but why did it affect global variables like $_GET , where technically you had to give a string from the beginning (so PHP programmers couldn't forget about the ${'a.b'} tags in the case of $_GET ).

And why does this only affect dots and spaces? Although I can understand the dots ( <input type=image> ) why this would affect the spaces. What about a hyphen?

+6
source share

Source: https://habr.com/ru/post/918367/


All Articles