Definition :
The PHP ftell() function returns the current position of the file read/write pointer in an open file.
ftell(file)
Parameter | Description |
---|---|
file | Required. Specifies the open file to check |
Example:
Lets assume that we have a file called demo.txt. This file contains following content:
This is a test file.
It contains dummy content.
In the example below, the file is opened using fopen() function with 'r' mode. While reading this file, this function is used to get the current position of the file pointer.
Output :
At beginning: 0
After 14 bytes: 14
After first line: 21
After second line: 48