[PHP] Re: 2nd Pass of array empty

2001-08-30 Thread CC Zona

In article [EMAIL PROTECTED],
 [EMAIL PROTECTED] (Ben Edwards) wrote:

 I have some code which loops through a n array using a for loop.  This
 works fine but if I try to loop through the array again in the same script
 the array seems to be empty (i,e, the loop douse not do any interations).
 Do I need to reset the array pointer at the begining?  Is there something
 else I need to do?

Yes, a reset sounds like the likely solution. http://php.net/reset  If 
that's not it, then repost with a code example.

-- 
CC

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: 2nd Pass of array empty

2001-08-30 Thread Andrey Hristov

Use foreach and there will not be a need of reset because foreach is not moving the 
internal array pointer.

foreach ($somearray = $value){ } 
foreach ($somearray as $key = $value) { }

Andrey Hristov
IcyGEN Corporation
http://www.icygen.com
99%


- Original Message - 
From: CC Zona [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, August 30, 2001 12:42 PM
Subject: [PHP] Re: 2nd Pass of array empty


 In article [EMAIL PROTECTED],
  [EMAIL PROTECTED] (Ben Edwards) wrote:
 
  I have some code which loops through a n array using a for loop.  This
  works fine but if I try to loop through the array again in the same script
  the array seems to be empty (i,e, the loop douse not do any interations).
  Do I need to reset the array pointer at the begining?  Is there something
  else I need to do?
 
 Yes, a reset sounds like the likely solution. http://php.net/reset  If 
 that's not it, then repost with a code example.
 
 -- 
 CC
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]