Jump to content

help with fgetcsv()


ashutoash

Recommended Posts

I am trying to display rows starting with a specific tag when using fgetcsv() like rows starting with tag SY or AP where the first element of each such rows would have SY or AP has prefix example SY-Atlanta, SY-Texas, AP-Atlanta, AP-texas. The next columns in that row would have some data. I want to display only rows with above said prefix. What is the best way to do it? Use preg_match for each row and display it only if it has a match or is there any easier way?

 

Sample data in csv:

 

SY-Atlanta,0,0,0,5,9,9,0

SY-Texas,0,5,8,0,0,8.4

AP-Atlanta,9,4,8,9,0,0,0

AP-Texas,8,0,9,0,0,0,0

DF-Atlanta,8,4,9,3,0,0,0,0

DF-Texas,8,4,9,0,0,0,0,0

Link to comment
https://forums.phpfreaks.com/topic/250638-help-with-fgetcsv/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.