The rewind() function rewinds a file pointer. It moves it to the beginning of the file. It returns True on success or False on failure.
Syntax
rewind(file_pointer)
Parameters
file_pointer − It must point to a file opened by fopen()
Return
The rewind() function returns True on success or False on failure.
Example
$file_pointer = fopen("new.txt", "r"); // Position of the file pointer is changed fseek($file_pointer, "12"); // Setting the file pointer to the beginning of the file rewind($file_pointer); fclose($file_pointer);
Output
TRUE