PHP script – Read File By Line

function readLine($file, $line_number) {
/*** read the file into the iterator ***/
$file_obj = new SplFileObject( $file );

/*** seek to the line number ***/
$file_obj->seek( $line_number );

/*** return the current line ***/
return $file_obj->current();
}