On Wed, 07 Jan 2009 15:41:44 Steve Boyd wrote:
> $fh = fopen('data.txt');
> while ($line = fgets($fh)) {
>   preg_match(...,$line); ...
> }
> fclose($fh);

The issue is with this code, is while it reads the whole file, the array out 
put of preg_match_all is empty. (note that preg_match also returns empty).

$fh = fopen($filename,"r");
while ($content = fgets($fh)) {

preg_match_all($pattern,$content,$matches);

}
fclose($fh);

print_r($matches);
exit();

OUTPUT OF PRINT_R()

Scanning files: Array
(
    [0] => Array
        (
        )

    [1] => Array
        (
        )

    [2] => Array
        (
        )

)

--~--~---------~--~----~------------~-------~--~----~
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]
-~----------~----~----~----~------~----~------~--~---

Reply via email to