Latest web development tutorials

PHP ftell () function

PHP Filesystem Reference Manual Complete PHP Filesystem Reference Manual

Definition and Usage

ftell () function returns the current position in the open file.

Returns the current position of the file pointer, on failure returns FALSE.

grammar

ftell(file)

参数 描述
file 必需。规定要检查的已打开文件。


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

The code above will output:

0
15


PHP Filesystem Reference Manual Complete PHP Filesystem Reference Manual