Latest web development tutorials

PHP rewind () function

PHP Filesystem Reference Manual Complete PHP Filesystem Reference Manual

Definition and Usage

rewind () function rewinds the file pointer location beginning of the file.

If successful, the function returns TRUE. If it fails, it returns FALSE.

grammar

rewind(file)

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


Examples

<?php
$file = fopen("test.txt","r");

//Change position of file pointer
fseek($file,"15");

//Set file pointer to 0
rewind($file);

fclose($file);
?>


PHP Filesystem Reference Manual Complete PHP Filesystem Reference Manual