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

From: Date: Sun, 10 Aug 2014 22:31:13 +0000
Subject: what is the main difference between fread() and readfile()?
Groups: php.general 
Request: Send a blank email to php-general+get-323722@lists.php.net to get a copy of this message
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*

« previous php.general (#323722) next »