RE: [PHP-DB] RE: adding in arrays

From: Date: Tue, 10 Dec 2002 13:04:22 +0000
Subject: RE: [PHP-DB] RE: adding in arrays
Groups: php.db 
Request: Send a blank email to php-db+get-24003@lists.php.net to get a copy of this message
> -----Original Message----- > From: Martin Allan Jensen [mailto:bailey@sprit.dk] > Sent: 10 December 2002 12:41 > > But, now i need to make another loop where it takes the key > [2000] and put's it into $year and takes the value 300 and > put it into $value > Can you help me with it, am really not good at arrays..... Is this what you want: foreach ($array as $year=>$value): // do stuff endforeach; > > Array ( [2000] => 300 [2002] => 740 [2003] => 200 [2004] => > 150 [2005] => 250 ) Cheers! Mike --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: m.ford@lmu.ac.uk Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211

« previous php.db (#24003) next »