Friday, August 10, 2018

variable variables - what is "$$" in PHP

foreach($_POST as $key=>$value)$$key=$value;

now, automagically, if the previous form had a field named 'username' you now have a variable called $username that holds the value submitted in the form.
not the greatest or secure method, but when you have a pocket full of nails, this is a heck of a hammer


this is pretty bad practice and is never encouraged but all PHP coders I know secretly sorta like it.

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...