ftell
Returns the location where the file pointer is read/write
The current location of ftell()
function in the open file.
This function returns the current location of the file pointer. If it fails, return false.
<?php $file = fopen ( "test.txt" , "r" ) ; // Output the current position echo ftell ( $file ) ; // Change the current position fseek ( $file , "15" ) ; //Open the current position again echo ftell ( $file ) ; fclose ( $file ) ; ?>
Output:
0 15
ftell ( file )
parameter | describe |
---|---|
file | Required. Specifies the open files to be checked. |
The file pointer file must be valid and must point to a file that was successfully opened via fopen()
or popen()
.
In additional mode (adding parameter "a" to open the file) ftell()
returns an undefined error.