Re: Looping problem

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

 



I'm not sure I understand what you want.
You mean you write out what you find between each two times your criteria is
met ?

Luis
----- Original Message -----
From: "Gerardo Rojas" <grojas@strategicinc.com>
To: <php-windows@lists.php.net>
Sent: Thursday, September 25, 2003 2:57 PM
Subject:  Looping problem


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


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux