Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

when post a var contains "." then the "." changed to "_"

Tags:

php

for example,in page1 I sended :

test.info :1;

then in page2:

echo $_REQUEST['test.info'];
echo $_REQUEST['test_info'];

first one is null ,second is 1 it changed to test_info

I just don't know the reason why the $key changed .

like image 788
Leo Avatar asked Aug 05 '13 08:08

Leo


1 Answers

It's from the old days of php, when post, get etc. variables were turned into regular global variables. But as these have the limitation that they cannot contain dots, dots were turned into _

$test.info - invalid variable name

$test_info - valid

like image 163
Marek Avatar answered Sep 28 '22 14:09

Marek