paulman888888 Posted August 9, 2008 Share Posted August 9, 2008 How do i when reading a file ship the 1st 6 lines? I have looked on google and php.net Thankyou Paul Link to comment https://forums.phpfreaks.com/topic/118908-solved-simple-question/ Share on other sites More sharing options...
ratcateme Posted August 9, 2008 Share Posted August 9, 2008 so do you just want the first 6 lines or do you want to dump them you could do something like this //first 6 lines $fh = fopen("file","r"); $line = 1; while(!feof($fh)){ if($line > 6) break; $data .= fgets($fh); $line++; } //skip first 6 lines $fh = fopen("file","r"); $line = 1; while(!feof($fh)){ if($line > 6){ fgets($fh); $line++; }else{ $data .= fgets($fh); } $line++; } Scott. Link to comment https://forums.phpfreaks.com/topic/118908-solved-simple-question/#findComment-612294 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.