Quick note when using next(), it appears that you have to already be at the end of the line in order for it to hop to the next one. I realized this while attempting to do a lineCount implementaiton like the following:<?php function lineCount($file) { $x=0; while(!$file->eof()) { $x++; $file->next(); } return $x; } $file=new SplFileObject("something"); echo lineCount($file);?>It ended up in an infinite loop. The solution was to just call fgets()/current() in the loop, although it wasn't being used anywhere so the following works:<?php function lineCount($file) { $x=0; while(!$file->eof()) { $file->current(); $x++; $file->next(); } return $x; } $file=new SplFileObject("something"); echo lineCount($file);?>