Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

brackets vs $$ for variables

$
0
0

Hi everyone, I have a question. Which code is better at extracting variables:

 

a.)

foreach($_POST as $var=>$value){

${$var} = $value;

}

 

-or-

 

b.)

foreach($_POST as $var=>$value){

$$var = $value;

}

 

Does version "b" have any pitfalls?

 

Thank you.


Viewing all articles
Browse latest Browse all 13200

Trending Articles