0

Possible Duplicate:
What does $$ mean in PHP?

I can't find documentation for this anywhere. You'd think it would be easy!

I came across this piece of code when reading through a webmail client framework (favourite pass time hobby) and i dont know what $$ means...

if (isset($_POST)){
while ( list($var, $val) = each($_POST) ) $$var = input_filter($var,$val);
}

Could somebody also explain basically what this does?

My interpretation is

if post is set
    loop until end of $_POST
        initialise each $_POST as a variable,
        filter variables
    end loop
end if
Community
  • 1
  • 1
AlexMorley-Finch
  • 6,144
  • 15
  • 62
  • 100

2 Answers2

5

http://www.php.net/manual/en/language.variables.variable.php

SylvainD
  • 1,625
  • 1
  • 11
  • 24
1

it's basically mimicing "register globals" for POST. $$var means take whatever $var evaluates to (it's a string) and make a variable of that name. So if $var is "email" then $$var is the same as $email.

Aerik
  • 2,193
  • 1
  • 23
  • 38