Forget my previous response, I misread your post...

-----Original Message-----
From: Croskerry, Dan [mailto:[EMAIL PROTECTED] 
Sent: Thursday, September 25, 2003 10:22 AM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-WIN] Looping problem


Instead of testing whether or not it is the first time through the loop
every time why not just enter the loop after the first read?

-----Original Message-----
From: Gerardo Rojas [mailto:[EMAIL PROTECTED] 
Sent: Thursday, September 25, 2003 10:04 AM
To: Herhuth, Ron; [EMAIL PROTECTED]
Subject: RE: [PHP-WIN] Looping problem


I don't want to break from the loop.  I want to loop the entire file.  The
problem is: the first time i find a match = i do nothing, append to array.

the second, third, fourth, .... and so on = I write the array, clear it and
append to it.


-----Original Message-----
From: Herhuth, Ron [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 25, 2003 9:08 AM
To: Gerardo Rojas
Subject: Re: [PHP-WIN] Looping problem


Can't you just insert a "Break;" when condition are met?  This will break
out of the loop.

Ron

>From: Gerardo Rojas
>To: [EMAIL PROTECTED]
>Sent: 09/25/2003 10:04 AM
>I'm looping through a file, parsing each line of text.  I have a global
array that i append each line to.  When my criteria is met.  I mark that
line.  This line will begin an array that I will later write out.  After
writing out the array I zap it and reuse it for the next time my criteria is
met.  The problem I'm having is the first time my criteria is met, I don't
want to write out the array, only the subsequent times my criteria is met;
do I want to write out the array.  Any suggestions?
>
>----------------------
>
>function parse_qnas($string, $path, $start_flag )
>{      
>       global $aNEW;
>
>       $Pat1 = "Q";
>       $Pat2 = "?";
>       $aTmp   = array();
>
>       $ret1           = gsr_match_case_sensitive($string, $Pat1);
>       $ret2           = gsr_match($string, $Pat2);
>
>       if( $ret1 && $ret2 )
>       {       
>               if( $start_flag == false )
>               {       
>                       echo "<P>First QnA found! Don't write array!";
>                       $start_flag = true;
>               }
>
>               if( $start_flag == true )
>               {       
>                       echo "<P>Second QnA found! Write array!";
>                       write_array( $aNEW );
>                       $aNEW = zero_array( $aNEW );
>               }
>       }
>
>       $aNEW[] = $string;
>
>       return;
>}
>
>
>







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


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


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

Reply via email to