I am unable to understand variable Parsing.
I have gone through this link uniform_variable_syntax but this link is so hard me for understand.
class Test{
public $var=array('baz'=>'a');
function a(){
return 'amazing_class<br/>';
}
}
function a(){
return 'amazing_out_of_class<br/>';
}
$obj=new Test();
$bar='var';
echo "1. ".$obj->$bar['baz'](); //Output amazing_out_of_class
$bar=array('baz'=>'a');
echo "2. ".$obj->{$bar['baz']}(); //Output amazing_class
Now lets look at first case : $obj->$bar['baz']()
($obj->$bar)['baz']()
>>> ($obj->var['baz'])() >>> a()
>>> amazing_out_of_class
Now i also suppose it $obj->{$bar['baz']}()
parsed same as above and expected Notice error : undefined Property a
$obj->{$bar['baz']}()
>>> ($obj->a)() >>> ($obj->a) is Notice error : undefined Property a
Notice error : undefined Property a
is my assumption according to first case but its output amazing_class