#!/usr/bin/php
= ($buffer_size - 1)) {
if ($line[($buffer_size - 2)] != '\n') {
$read_again = true;
}
}
}
return $full;
}
/* Using file().
Note Can pass URLs! Also can use chop() to
remove the trailing newlines in each array element.
In PHP 4.0.0 and lower, array elements are never longer than 8190 characters.
Longer lines are split. This limitation was removed in PHP 4.0.1.
Readfile() is binary safe while file() is not.
Doesn't scale well to large files
*/
// get a web page into an array and print it out
$fcontents = file ('http://www.php.net');
while (list ($line_num, $line) = each ($fcontents)) {
echo "Line $line_num: " . htmlspecialchars ($line) . "
\n";
}
// get a web page into a string
$fcontents = join ('', file ('http://www.php.net'));
?>