VOOZH about

URL: https://www.geeksforgeeks.org/php/php-splfileobject-rewind-function/

⇱ PHP | SplFileObject rewind() Function - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

PHP | SplFileObject rewind() Function

Last Updated : 11 Jul, 2025

The SplFileObject::rewind() function is an inbuilt function of Standard PHP Library (SPL) in PHP which is used to Rewind the file to the first line.

 
Syntax: 

void SplFileObject::rewind( $line_num)


Parameters: This function does not accept any parameter.


Return values: This function does not return any value.


Below Programs illustrate the SplFileObject::rewind() function in PHP:
Program-1: 

Output: 

<?php


Program-2: 


Output: 
GeeksforGeeks
gfg
contribute

 

Reference: https://www.php.net/manual/en/splfileobject.rewind.php
 

Comment