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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.