The ftell() function returns the current position in an open file.
PHP ftell() Function has the following syntax.
ftell(file)
Parameter | Is Required | Description |
---|---|---|
file | Required. | Open file to check |
Returns the current file pointer position, or FALSE on failure.
Returns the current position in an open file
<?php/* w w w .j a v a 2 s.c om*/
$file = fopen("test.txt","r");
// print current position
echo ftell($file);
// change current position
fseek($file,"25");
// print current position again
echo "\n";
echo ftell($file);
fclose($file);
?>
The code above generates the following result.