Cannot use string offset as an array



Why do i get an error on this line?

if( $this->$switch_b[$i]['module_id'] == $id )

it says:
Fatal error: Cannot use string offset as an array in D:\htdocs\******
\includes\classes\modules.php on line 307



full code:


function get_module_data($switch, $id)
{
$switch_b = 'info_' . $switch;

for( $i = 0; $i < count($this->$switch_b); $i++ )
{
LINE 307-> if( $this->$switch_b[$i]['module_id'] == $id )
{
$arr = $this->$switch_b[$i];

foreach( $arr as $key => $value )
{
$this->mod_data[$key] = $value;
}
}
}

if( empty($this->mod_data) )
{
message_handler(GENERAL_MESSAGE, 'Module data not found');
}

return $this->mod_data;
}


thanks
.