what is the main difference between fread() and readfile()?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



fread
(PHP 4, PHP 5)

fread — Binary-safe file read
Description ¶
<http://us1.php.net/manual/en/function.fread.php#refsect1-function.fread-description>
string fread ( resource $handle , int $length )

fread() reads up to length bytes from the file pointer referenced by handle.
Reading stops as soon as one of the following conditions is met:
readfile

(PHP 4, PHP 5)

readfile — Outputs a file
Description ¶
<http://us3.php.net/manual/en/function.readfile.php#refsect1-function.readfile-description>
int readfile ( string $filename [, bool $use_include_path = false [,
resource $context ]] )

Reads a file and writes it to the output buffer.

in which condition it's better to use them? I confronted a question that is
asking which of the following functions reads the entire contents of a file?

A.fgets

B.file_get_contents

C.fread()

D.readfile()

E.file()

in my opinion the answer is B,C,D,E

but the answer key is telling me the answer is B,D,E so fread for some
reason is not the answer and I cannot understand.

*john coggshall and Marco Tabini  test book*

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux