Cannot use string offset as an array
- From: "Tree*Rat" <tree.rat@xxxxxxxxxxxxxx>
- Date: Thu, 27 Nov 2008 10:54:21 GMT
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
.
- Follow-Ups:
- Re: Cannot use string offset as an array
- From: "Álvaro G. Vicario"
- Re: Cannot use string offset as an array
- From: trookat
- Re: Cannot use string offset as an array
- Prev by Date: Re: Automatic masking in PHP when using FORMS/POST
- Next by Date: Re: Cannot use string offset as an array
- Previous by thread: newbie: debbuging multi-page website with Eclipse PDT
- Next by thread: Re: Cannot use string offset as an array
- Index(es):