Explanation:
Answer option D is correct.
The ftell()
function is used to return the current position of the file read/write pointer. It gives the undefined results for append-only (a) streams. The syntax of the ftell()
function is as follows:
int ftell ( resource $handle )
where $handle is the file pointer.
Answer option A is incorrect. The fread() function is used to read from an open file. It stops at the end of the file or when it reaches the specified length, whichever comes first. The syntax of the fread function is as follows:
string fread (resource $handle, int $length)
The fread()
function reads up to 'length' bytes from the file pointer referenced by 'handle'.
Answer option C is incorrect. The feof()
function is used to test whether the file pointer is at end of the file or not. The syntax of the feof()
function is as follows:
bool feof (resource $handle)
If a connection is opened by the fsockopen()
function that is not closed by the server, feof()
waits until a timeout reaches to return TRUE. The default timeout value of the feof()
function is 60 seconds.
Answer option B is incorrect. The fseek()
function is used to move the file pointer from its current position to a new position, forward or backward, specified by the number of bytes. The syntax of the fseek()
function is as follows:
int fseek ( resource $handle , int $offset [, int $whence ] )
where $handle is the file pointer, $offset is the position to move, and whence parameter is used to set the cursor relative to offset.
Reference: http://www.php.net/manual/en/function.ftell.php