cgm225 Posted April 13, 2008 Share Posted April 13, 2008 Will someone explain this code snippet to me in word? foreach ($this->viewData as $key => $value) { $$key = $value; } Link to comment https://forums.phpfreaks.com/topic/100917-will-someone-example-with-code-snippet-to-me-in-words/ Share on other sites More sharing options...
Orio Posted April 13, 2008 Share Posted April 13, 2008 First, I must say this is some ugly piece of code. This goes over all of the elements in $this->viewData. Then it creates a variable for every value, and the name of the value (the variable name) is the key's value. Example If viewData contains [keyname] => "value", [something] => "random_val" Running these two lines will create two variables: $keyname, $something (The first with the value "value" and the second holding "random_val"). Orio. Link to comment https://forums.phpfreaks.com/topic/100917-will-someone-example-with-code-snippet-to-me-in-words/#findComment-516078 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.