RE: RE: adding in arrays

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

 



> -----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 

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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux