ftell() 関数は、オープンしているファイルの現在の位置を返します。
現在のファイルポインタの位置を返します。失敗した場合はFALSEを返します。
ftell(file)
パラメータ | 説明 |
---|---|
file | 必須。open チェックするファイルを指定する |
<?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);
?>
上のコードの出力は、次の通り:
0
15