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