php - Returning selected rows from a csv -


i'm using php(fgetcsv) in order parse csv file. file continuously updated , quite large. possible return selected number of rows(say first 10 rows example)?

i think can read data row wise , return whichever rows want keeping track @ current row number.

$pickedrows  = array(1, 3, 5); $currentrow=0; $thedata = array(); if (($handle = fopen("test.csv", "r")) !== false) {     while (($data = fgetcsv($handle, 1000, ",")) !== false) {             if(in_array(currentrow, $pickedrows))                  $thedata[] = $row;              $currentrow++;      }     fclose($handle); } 

Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -