php3-list | 199908
Date: 08/30/99
- Next message: Shafiek Savahl (EPA): "[PHP3] Interntionalisation"
- Previous message: Chris Carbaugh: "[PHP3] TEST --> can we post here?"
- In reply to: Joshua L Bowser: "[PHP3] Reading From Files"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
At 06:43 PM 8/30/99 -0400, you wrote:
>Can someone give me an example of reading from a file, and searching for a
>string?
<?php
$path = '/full/path/to/file.txt';
$file = fopen($path, 'r') or die("Could not open $path. Check
permissions.");
$linenumber = 0;
while (!feof($file)){
$line = fgets($file, 1000000);
$linenumber++;
if (strstr($line, 'a string')){
echo $linenumber, '. ', $line, "<BR>\n";
}
}
fclose($file);
?>
-- "TANSTAAFL" Websites I have built: CHaTMusic.com EmphasisEntertainment.com L-I-E.com JadeMaze.com CatCatalani.com MGMH.com AstraKelly.com OlivierLedoux.com-- PHP 3 Mailing List <http://www.php.net/> To unsubscribe, send an empty message to php3-unsubscribe <email protected> To subscribe to the digest, e-mail: php3-digest-subscribe <email protected> To search the mailing list archive, go to: http://www.php.net/mailsearch.php3 To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Shafiek Savahl (EPA): "[PHP3] Interntionalisation"
- Previous message: Chris Carbaugh: "[PHP3] TEST --> can we post here?"
- In reply to: Joshua L Bowser: "[PHP3] Reading From Files"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

