Curriculum
Course: PHP Basic
Login

Curriculum

PHP Basic

PHP Install

0/1

PHP Casting

0/1

PHP Constants

0/1

PHP Magic Constants

0/1

PHP Operators

0/1

PHP Reference

0/276
Text lesson

rewind()

Example

Reset the file pointer position to the start 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 resets the file pointer to the beginning of the file.

Syntax

rewind(file)

Parameter Values

Parameter

Description

file

Required. Specifies the open file or stream.

Technical Details

Return Value:

Returns TRUE on success, FALSE on failure.

PHP Version:

4.0+