VOOZH about

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

⇱ PHP | SplFileObject seek() Function - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

PHP | SplFileObject seek() Function

Last Updated : 11 Jul, 2025
The SplFileObject::seek() function is an inbuilt function of Standard PHP Library (SPL) in PHP which is used to seek to specify the line. Syntax:
void SplFileObject::seek( $line_num)
Parameters: This functions accept only one parameter $line_num which specifies the line number of the file. Return values: This function does not return any value. Below Programs illustrate the SplFileObject::seek () function in PHP: Program-1: Output:
// SplFileObject Seek function
Program-2:
Output:
GeeksforGeeks
gfg
contribute
Reference: https://www.php.net/manual/en/splfileobject.seek.php
Comment