Possible Duplicate:
What does $$ (dollar dollar or double dollar) mean in PHP?
I found myself using this kind of code in one of my controllers:
foreach(get_object_vars($this->view) as $property=>$value){
$$property = $value;
}
Is there any problem with using the $$property to "localize" view properties into simple $variables?
edit:
I should add that this code is run in the scope of a view-specific method, so there's no problem of overriding local variables. This is to divert some of you guys from pointing out the problem of overriding local variables.
The problem with $$ in PHP is that you create unknown variable names, that may override variable names you already use. It is a source for subtle programming errors, and should generally not be used.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With