Re: Multi Dimensional Arrays?
| From: | tcuhost at hotmail dot com | Date: | Mon, 07 May 2001 17:11:59 +0000 |
| Subject: | Re: Multi Dimensional Arrays? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-51777@lists.php.net to get a copy of this message | ||
I would have to say you would need a nested for loop to count your array.
$j = 0 ;
$k = 0 ;
for ( ; $j != '' ) ; $j++ )
{
//top of the col.
echo "$main_menu[$j][$k]<br>";
for ( $k = 1; $k != '' ; $k++ )
{
// then everything under the col (by row)
echo "$main_menu[$j][$k]<br>";
}
}
----- Original Message -----
From: "Brandon Orther" <orther@webintellects.com>
To: "PHP User Group" <php-general@lists.php.net>
Sent: Monday, May 07, 2001 8:59 AM
Subject: [PHP] Multi Dimensional Arrays?
Hello,
I am working on a menu script that I wanted to use multi-dimensional arrays
for.
Here is the conf file I have:
//Main Menu Array
$main_menu[0] = "Menu 1"; //Represents the name of the menu
//Menu 1 Array
$main_menu[0][0] = "Test 1";
$main_menu[0][1] = "Test 2";
$main_menu[0][2] = "Test 3";
$main_menu[0][3] = "Test 4";
When I try to us count like:
$count = count($main_menu[0]);
I only get 1. My question is how do I count a multi dimensional array.
Thanks for the help,
Brandon
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net