Re: Multi Dimensional Arrays

From: Date: Tue, 09 Jan 2001 00:36:34 +0000
Subject: Re: Multi Dimensional Arrays
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-33361@lists.php.net to get a copy of this message
Hello Brandon, (BO == "Brandon Orther") brandon@webintellects.com writes: BO> ----------------------------------------- BO> 54=6.00 BO> 65=5.50 BO> 43=3.37 BO> ----------------------------------------- BO> The first number represents the product number and the second BO> number represents the price. I have exploded this and created an BO> array for each line. Now what I would like to do is create a multi BO> dimensional array that is like bellow: BO> $array[0][0] == 54 BO> $array[0][1] == 6.00 $array[0]['ID'] = 54; $array[0]['Amount'] = 6.00; BO> $array[1][0] == 65 BO> $array[1][1] == 5.50 $array[1]['ID'] = 65; $array[1]['Amount'] = 5.50; BO> $array[2][0] == 43 BO> $array[2][1] == 3.37 $array[2]['ID'] = 43; $array[2]['Amount'] = 3.37; BO> Does anyone know how I could do this? $count = sizeof($array); for($i = 0; $i < $count; $i++) { print 'ID: ' . $array[$i]['ID'] . '<br>'; print 'Amount: ' . $array[$i]['Amount'] . '<br>'; print '<p>'; } BO> Thank you, Would that do what you want? -Brian

« previous php.general (#33361) next »