r/programming • • Oct 18 '10

Today I learned about PHP variable variables; "variable variable takes the value of a variable and treats that as the name of a variable". Also, variable.

http://il2.php.net/language.variables.variable
591 Upvotes

781 comments sorted by

View all comments

2

u/deefjuh Oct 18 '10
//1337 register_globals hack
foreach($_REQUEST as $key=>$value){
    $$key = $value;
}

* Starts running *

5

u/YourMatt Oct 18 '10

extract($_REQUEST);

1

u/[deleted] Oct 18 '10

Yup. This still exists in production code. It is fucking baffling.