Monday, October 27, 2008

Scan a file Line by Line using PHP

/* Scan a file Line by Line using PHP */
/*
Author : evergreenphp
Website : http://evergreenphp.blogspot.com
Website Info : Lots of source code
FREEly available, in PHP, javascript, AJAX,
MySQL etc.,
Description : Scan a file Line by Line using PHP also we can scan any document files using this CODE.
*/

/* Configuration settings start */
$file = '/www/htdocs/evergreenphp/discount.txt';
/* Configuration settings ends */

if (file_exists($file)) {

// put file into an array to be scanned
$lines = file($file);
$cnt_lines = 0;

// loop through the array, show line and line numbers
foreach ($lines as $line_num => $line) {
echo $cnt_lines . " " . htmlspecialchars($line);
echo "
";
$cnt_lines++;
}
}
?>

1 comment:

andy said...

Very Nice Blog Posting https://smtqatar.com/product-category/printers/ Now a days mobile website designing is much higher than other... keep blogging.

Popular Posts