PHP rewind() Function

❮ PHP Filesystem Reference

Example

Rewind the position of the file pointer to the beginning of the file:

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

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

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

fclose($file);
?>


Definition and Usage

The rewind() function "rewinds" the position of the file pointer to the beginning of the file.

Syntax

rewind(file)

Parameter Values

Parameter Description
file Required. Specifies the open file


Technical Details

Return Value: TRUE on success, FALSE on failure
PHP Version: 4.0+

❮ PHP Filesystem Reference
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.