I have a program that generates text files, and I want to read that file and extract a specific data from it with.
The script needs to search the text file keys, and return the value into a variable .
My text file looks this:
"KEY1" "value to be returned" timestamp
"KEY2" "value to be returned" timestamp
I’ve tried with explode, etc, but it not works.
Thank you in advance,
Andy.
You could use
fgetscsv().This will read your file like a CSV, but will use the space as a delimiter.
explode()is too blunt a tool for this, as you’re using quotes to give spaces their literal meaning.