PHP bug within multi. dimensional arrays?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi there,

I am outputting an multidim. array. That works fine, except one thing. The first letter of the value inside dimension 1 always gets printed.

For example:

I fill the arrays:
while ($row = mysql_fetch_object($result)){		
	$cat[$row->main_id][name] 		= $row->main_name;	
	$cat[$row->main_id][$row->sub_id][name] = $row->sub_name;			
}

Then I output them:
foreach ($cat AS $maincat){
	echo $maincat[name].':';
	foreach($maincat AS $subcat){
		echo $subcat[name].$br;
	}
	echo $br;
}

Which does result in:

Europe:E
Germany
UK

North America:N
US
CA

As you can see I get the extra letters N and E. Is this an php error or did I do something wrong?

Thanx for any hint,

Merlin

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux