PHP rewind() Function

PHP rmdir() Function
PHP rename() Function

In this article, you will learn how to move the position of the file pointer to the start of the file in PHP. The rewind() function in PHP rewinds the position of the file pointer to the beginning of the file.

what is the syntax of the REWIND function in php?

rewind(file)
ParameterDescription
fileRequired. Specifies the open file
PHP rewind() method

examples of the REWIND function

Example 1. In this example, we 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);
?>
PHP rmdir() Function
PHP rename() Function
en English
X
Scroll to Top