I have a file that contains 100 highscores for a game I’m scripting.
1.2345, name1
1.3456, name2
1.4567, name3
for example.
With php, I need to get the content of the line nameX appears on so I can overwrite it if the new score is higher than the old score. Also I need to find out which line number nameX appears on so they know what place (ranking) they are in.
Which php functions should I look into so that I can make this work?
You can either use
fopenandfreadorfilefor this one. Personally, I would opt for file as it sounds like this is a fairly small file to begin with.For good measure, the fopen approach: