PHP ftell()Functions
Complete PHP Filesystem Reference Manual
Definition and Usage
The ftell() function returns the current position in an open file.
Returns the current position of the file pointer, or FALSE on failure.
Syntax
ftell(file)
| Parameters | Description |
|---|---|
| file | Required. Specifies the open file to be checked. |
Examples
<?php
$file = fopen("test.txt","r");
// print current position
echo ftell($file);
// change current position
fseek($file,"15");
// print current position again
echo "<br />" . ftell($file);
fclose($file);
?>
$file = fopen("test.txt","r");
// print current position
echo ftell($file);
// change current position
fseek($file,"15");
// print current position again
echo "<br />" . ftell($file);
fclose($file);
?>
The above code will output:
0
15
15
Complete PHP Filesystem Reference Manual Other Extensions