array file ( string $filename [, int $flags = 0 [, resource $context ]] )
Reads entire file into an array
Reads an entire file into an array.
<?php
// Get a file into an array. In this example we'll go through HTTP to get
// the HTML source of a URL.
$lines = file('http://www.example.com/');
// Loop through our array, show HTML source as HTML source; and line numbers too.
foreach ($lines as $line_num => $line) {
echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($line) . "<br />\n";
}
// Another example, let's get a web page into a string. See also file_get_contents().
$html = implode('', file('http://www.example.com/'));
// Using the optional flags parameter since PHP 5
$trimmed = file('somefile.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
?>
5.0.0 The context parameter was added 5.0.0 Prior to PHP 5.0.0 the flags parameter only covered include_path and was enabled with 1 4.3.0 file() became binary safe
(FREE Download) Minecraft Beta - One Step Install - Easy Update - Hybrid PC, Mac and Linux
0 Comment:
Post a Comment