I wanna know how php interprets this code. Is it something of syntax error or matching priorty? I appreciate any help.
Code:
// php 5.3
class Man {
var $arr = array('name'=>'me');
}
$key = 'name';
$man = new Man();
echo $man->arr['name']; // output me
echo $man->$key['name']; // output nothing along with warning and notice
// output:
PHP Warning: Illegal string offset 'name' in php shell code on line 1
PHP Notice: Undefined property: Man::$n in php shell code on line 1