0
Good morning to you all! Guys, I’m relatively new to php, and in one of the jobs here at the company, I’m having a difficulty, which may seem simple, but n found solution in my searches, which is like skipping a line in a txt file.
What I want to do is simple, read a txt file, when I find a particular word, I need to jump to the next line and read those lines until the word is found again. I have more experience in java, and in java we have a method called readLine()
, which automatically switches to the next line. I saw that in php there is this readLine()
, but did not know how to apply, or it is different than what I use in java.
Well, thank you in advance for your help and attention.
Thank you!
If it’s a small file you can use
file()
which transforms the file into an array then usearray_search()
orin_array()
to find the desired term. Has the classic version withfopen()
andfgets()
– rray