(Sorry for my bad English, I use Google Translate)
I'm facing the problem of dynamically creating variables in the class.
There are classes at the entrance to __construct transferred to variables.
Further cycles
foreach ($collector as $key => $field) {
$this->$key = $field;
}
Variables are added to the class.
But this code works in other classes, except one.
Here is the class
foreach ($collector as $key => $field) {
$this->$key = $field;
if (isset($this->$key))
var_dump($this->$key);
}
var_dump('<pre>',$collector);
var_dump($this);
die();
var_dump('<pre>',$collector) - dumps the object
if (isset($this->$key))
var_dump($this->$key)
call magic __get(); since there is no variable
var_dump($this) - dumps the object but necessary variables I can not see.
Help me, please!