RE: [PHP] Nested Arrays
| From: | Paul Reed | Date: | Fri, 27 Dec 2002 07:48:28 +0000 |
| Subject: | RE: [PHP] Nested Arrays | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-129414@lists.php.net to get a copy of this message | ||
I didn't see this approach in any other reply.....
A multidimensional array is just an array of single dimensional
arrays... Basically $array[row#][col#]=$data;
$array[0][0]= "row0, col0";
$array[0][1]= "row0, col1";
This also works with associative arrays...
$cars[0]['make']="Ford";
$cars[0]['model']="Mustang";
$cars[1]['make']="Mazda";
$cars[1]['model']="RX7";
Although using an object/class would be better suited for the second
example....
Hope this help ..
Paul.
-----Original Message-----
From: Beauford.2002 [mailto:beauford.2002@rogers.com]
Sent: Thursday, December 26, 2002 18:14
To: PHP General
Subject: [PHP] Nested Arrays
Hi,
Is there anyway to do a nested array, I have looked at the various array
functions and can't figure this out (if possible).
I want to be able to put each field of a row into an array, and then
put
that entire row and into another array.
so when I display it, I would have:
row1 - col1 col2 col3 col4 col5
row2 - col1 col2 col3 col4 col5
row3 - col1 col2 col3 col4 col5
row4 - col1 col2 col3 col4 col5
row5 - col1 col2 col3 col4 col5
etc. (depending on how many rows there are).
TIA
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php