Course Recommendation:

PHP ftell() Function

Definition and Usage

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

This function returns the current position of the file pointer. If it fails, it returns false.

syntaxfile pointerftell(
) 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 pointer that is 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 the current position
// Change the current position
// Again output the current position
echo ftell($file);
fclose($file);
?>

Output:

0
15