Elective Courses

Course Recommendation:

PHP ftell() Function

Definition and Usage

ftell() function in the current position of the opened file.

The function returns the current position of the file pointer. If it fails, it returns false.file pointerSyntax
) Parameter
file pointer Description

Required. Specifies the open file to be checked.

Description file pointer file must be valid and must point to a file opened through fopen() or popen()

Successfully opened file.

In append mode (open file with parameter "a"), ftell() will return an undefined error.

Example
<?php
$file = fopen("test.txt","r");
echo ftell($file);
// Output current position
// Change current position
// Output current position again
echo ftell($file);
fclose($file);
?>

Output:

0
15