按变量访问对象属性

I've seen this asked before, but my particular case appears to be someone odd, and I'm unable to resolve it - any insight would be appreciated.

I'm trying to access an object property with a variable value, ie.

$foo = new Object();
$foo->first = 'bar';

$array = array(0 =>'first', 1 =>'second');

$var = 0;

return $foo->{$array[$var]};

This is throwing an error "Notice: Undefined property: stdClass::$first". Removing the braces returns an identical result.

What don't I understand? (Actual code and error below - the error is as recorded in a Drupal Watchdog log.)

private function load_questionnaire_queue($type, $comparator_id, $comparing_id_array)
{
  $queue = array();
  $type_map = array(
    0 => "field_portfolio_district['und'][0]['nid']",
    1 => "field_time_period['und'][0]['tid']",
  );

  foreach ($this->questionnaires as $q)
  {

    // The commented code below works as expected
    // if ($q->field_portfolio_district['und'][0]['nid'] == $comparator_id &&
    //      in_array($q->field_time_period['und'][0]['tid'], $comparing_id_array))

    // This returns an identical error, with or without braces:
    if ($q->{$type_map[$type]} == $comparator_id && 
            in_array($q->{$type_map[!$type]}, $comparing_id_array))
    {
      $queue[] = node_view($q, $view_mode = 'full');
    }
  }

  $this->queue = $queue;
}

Notice: Undefined property: stdClass::$field_portfolio_district['und'][0]['nid'] in ComparisonChart->load_questionnaire_queue()

This works like a charm:

<?php
$foo = new StdClass();
$foo->first = 'bar';

$array = array(0 =>'first', 1 =>'second');

$var = 0;

echo $foo->{$array[$var]};
?>

But I doubt this is gonna work:

<?php
$foo = new StdClass();
$foo->first = array('a' => array('b' => 'test'));

$array = array(0 =>'first["a"]["b"]', 1 =>'second');

$var = 0;

echo $foo->{$array[$var]};
?>