The precedence of '->' is less than '[' in this situation: object contains array, name of array is stored in string variable.
<?php
$farm = new StdClass;
$farm->emu = array( 'name' => 'Henry', 'age' => 9 );
$farm->rabbit = array( 'name' => 'George', 'age' => 4 );
$animal = 'rabbit';
print_r( $farm->$animal ); print( $farm->{$animal}[ 'name' ] ); $farm->wash = 'Suds';
$jobs = array( 'morning' => 'feed', 'evening' => 'wash' );
print( $farm->$jobs[ 'evening' ] ); print( $farm->{$jobs[ 'evening' ]} ); ?>