Current Location: Home> Function Categories> ftell

ftell

Returns the location where the file pointer is read/write
Name:ftell
Category:File system
Programming Language:php
One-line Description:Returns the read/write position of the file pointer

Definition and usage

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.

Example

 <?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

grammar

 ftell ( file )
parameter describe
file Required. Specifies the open files to be checked.

illustrate

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.

Similar Functions
Popular Articles