On Wed, 5 Mar 2003 10:21:30 -0500, 1LT John W. Holmes wrote: >> $ts = '/(' . $trigger_string .')/is'; >> echo "trigger_string is $ts <br>"; >> $matches = array(); >> $hit = array(); >> >> In the loop >> >> $hit[] = preg_match ($ts, $line_in,$matches); >> >> Now the $hit array fills up correctly, if the trigger string is on the >> line just read in, putting 1 or 0 in $hits. But the string that >> triggered the match is not put in $matches. The manual says it should >> be. > >What's your actual code? How are you looking for the match in $matches? >If something >was matched, then it'll be there.
The full cod in the loop is. $cnt = 0; while(!feof($fp)) { // Get body $line_in = fgets($fp,4096); $cnt++; // looking for the other end of the marker found above if (substr($line_in,2,strlen($line_in)-5) != $marker ) { $body = $body . $line_in; $hit[] = preg_match ($ts, $line_in,$matches); $line[] = $line_in; $char = substr($line_in,0,1); $quote[] = preg_match ($qs, $char); } if (strpos($line_in, $marker) > 0 ) { break; } } Later on in the code after the loop I do echo "printing array matches <br>"; print_r ($matches);echo "<br>"; echo "printing array hit <br>"; print_r ($hit); echo "printing array quote <br>"; print_r ($quote); echo "printing array lins <br>"; print_r ($line); $lcnt = count($line); echo "cnt of line array is $lcnt <br>"; $hcnt = count($hit); echo "cnt of hit array is $hcnt <br>"; $qcnt = count($quote); echo "cnt of quote array is $qcnt <br>"; $mcnt = count($matches); echo "cnt of matches array is $mcnt <br>"; the arrays $hit and $line and $quote all print data, and all the count($array) print a value except the $matches array and count are empty. {R} -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php