PHP ftell() Function
❮ PHP Filesystem ReferenceExample
Return the current position of the read/write pointer in an open file:
<?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);
?>
Run Example »
Definition and Usage
The ftell() function returns the current position of the read/write pointer in an open file.
Syntax
ftell(file)
Parameter Values
Parameter | Description |
---|---|
file | Required. Specifies the open file to check |
Technical Details
Return Value: | The file pointer position, or FALSE on failure. |
---|---|
PHP Version: | 4.0+ |
❮ PHP Filesystem Reference
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.