Let say i want to read a text file using php.
Now my text file contain
User=Test
Age=18
Gender=F
User=Test2
Age=34
Gender=M
and following like that.
Now let say i want to use php to read the text file and find only value of User= and display it.
What is the easiest way to accomplish this?
Thank you.
The above assumes that each bit of info is on a new line, that
User=is case-sensitive, and that you are okay with looping through whole file. You will get an array returned of just the user names on the right-side of theUser=.If you want that to be echoed out in a column, either change the bit where the $users array gets built, or add this to the end: