PHP ftell() Function
Definition
The ftell() function returns the current position in an open file.
Syntax
PHP ftell() Function has the following syntax.
ftell(file)
Parameter
Parameter | Is Required | Description |
---|---|---|
file | Required. | Open file to check |
Return
Returns the current file pointer position, or FALSE on failure.
Example
Returns the current position in an open file
<?php/*from www. ja v a2s .co m*/
$file = fopen("test.txt","r");
// print current position
echo ftell($file);
// change current position
fseek($file,"25");
// print current position again
echo "\n";
echo ftell($file);
fclose($file);
?>
The code above generates the following result.