Iam sorry if this kind of question has been asked before, but I couldnt find anything according to my question.
I've got a class which uses magic method like get and set. What I want is to use the property of an array as set "name", for later access the property using get "name".
What I do now:
$arr = array('name' => 'value')
$this->obj->name = $arr['name'];
What I want and doesnt work as I try:
$arr = array('name' => 'value');
foreach($arr as $item)
$this->obj->[$item] = $item['name'];
echo $this->obj->name; // result should be 'value'