PHP ftell()関数
完全な PHP Filesystem リファレンスマニュアル
定義と使用法
ftell() 関数は、開いているファイル内の現在位置を返します。
ファイルポインタの現在位置を返し、失敗した場合は FALSE を返します。
構文
ftell(file)
| パラメータ | 説明 |
|---|---|
| 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);
?>
$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
15
完全な PHP Filesystem リファレンスマニュアル その他の拡張機能