Re: [PHP] go through array

2003-06-18 Thread Diana Castillo
thanks, now if I want to take off the first element how can I do it and also
get the key back as well ? If I do an array shift that resets the keys and I
dont want to do that.


David Nicholson [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Hello,


This is a reply to an e-mail that you wrote on Tue, 17 Jun 2003 at 17:43,
lines prefixed by '' were originally written by you.

 I have this array:
 Array ( [2] = 6 [1] = 2 [3] = 2 )
 how do I go through it and get the key and the value in this order?

Use the foreach construct, it is documented at:
http://uk2.php.net/foreach

David.

--
phpmachine :: The quick and easy to use service providing you with
professionally developed PHP scripts :: http://www.phpmachine.com/

  Professional Web Development by David Nicholson
http://www.djnicholson.com/

QuizSender.com - How well do your friends actually know you?
 http://www.quizsender.com/
(developed entirely in PHP)



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



[PHP] go through array

2003-06-17 Thread Diana Castillo
I have this array:
Array ( [2] = 6 [1] = 2 [3] = 2 )
how do I go through it and get the key and the value in this order?





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



Re: [PHP] go through array

2003-06-17 Thread David Nicholson
Hello,


This is a reply to an e-mail that you wrote on Tue, 17 Jun 2003 at 17:43,
lines prefixed by '' were originally written by you.

 I have this array:
 Array ( [2] = 6 [1] = 2 [3] = 2 )
 how do I go through it and get the key and the value in this order?

Use the foreach construct, it is documented at:
http://uk2.php.net/foreach

David.

--
phpmachine :: The quick and easy to use service providing you with
professionally developed PHP scripts :: http://www.phpmachine.com/

  Professional Web Development by David Nicholson
http://www.djnicholson.com/

QuizSender.com - How well do your friends actually know you?
 http://www.quizsender.com/
(developed entirely in PHP)

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



RE: [PHP] go through array

2003-06-17 Thread Ford, Mike [LSS]
 -Original Message-
 From: Diana Castillo [mailto:[EMAIL PROTECTED]
 Sent: 17 June 2003 17:43
 
 I have this array:
 Array ( [2] = 6 [1] = 2 [3] = 2 )
 how do I go through it and get the key and the value in this order?

   foreach ($array as $key=$value)

(See www.php.net/foreach).

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: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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