You've run into the classic problem of php not being sure what to do with an array and a variable variable (i.e. $$var).
Now, the following var could be interpreted in two ways by php.
print $$tmp[0];
either we replace $tmp with some value and parse, or we replace $tmp[0] with it's var and parse.
In PHP we use {} to tell the parser which we mean.
i.e. we either have ${$tmp[0]} or ${$tmp}[0]
$tmp[0]="test";
$test="goodbye";
print ${$tmp[0]}; would print "goodbye"
while
$tmp="test";
$test[0]="hello";
print ${$tmp}[0]; would print "hello"