Jump to content

Array offset


anuradhu

Recommended Posts

Here is the code

 

if ($comp -> pvc[$real_bas_id]['name']!="") continue;
$tpl -> setVariable(array(
'BAS'	=> $real_bas_info['name'],
'BAS_ID'=> $real_bas_id,
));

 

and here is what i see when i try to dump the REAL_BAS_ID array

 

array(23) {
[7]=> array(1) { ["name"]=> string(11) "value" } 
[14]=> array(1) { ["name"]=> string(12) "value" } 
[23]=> array(1) { ["name"]=> string(13) "value" } 
[1]=> array(1) { ["name"]=> string(17) "value" } 
[20]=> array(1) { ["name"]=> string(18) "value" } 
[6]=> array(1) { ["name"]=> string(15) "value" } 
[13]=> array(1) { ["name"]=> string(16) "value" } 
[10]=> array(1) { ["name"]=> string(11) "value" } 
[19]=> array(1) { ["name"]=> string(12) "value" } 
[9]=> array(1) { ["name"]=> string(6) "value" } 
[17]=> array(1) { ["name"]=> string(7) "value" } 
[3]=> array(1) { ["name"]=> string(9) "value" } 
[21]=> array(1) { ["name"]=> string(10) "value" } 
[8]=> array(1) { ["name"]=> string(10) "value" } 
[15]=> array(1) { ["name"]=> string(11) "value" } 
[4]=> array(1) { ["name"]=> string( "value" } 
[16]=> array(1) { ["name"]=> string(9) "value" } 
[5]=> array(1) { ["name"]=> string(7) "value } 
[12]=> array(1) { ["name"]=> string( "value" } 
[22]=> array(1) { ["name"]=> string(9) "value" } 
[11]=> array(1) { ["name"]=> string(4) "value" } 
[2]=> array(1) { ["name"]=> string(7) "value" } 
[18]=> array(1) { ["name"]=> string( "value" } 
} 

Link to comment
Share on other sites

What is in $comp->pvc ?  If it is not an array, then that is probably the cause of the error.  The error is often caused like this:

 

$foo = 'bar';
print $foo[0]; # OK, treating a string as a 1 level array gives you a string offset instead
print $foo[0][0]; # Error!  Can't treat a string as a 2 level array

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.