I have a text file called test.txt
with the following contents:
{"FirstName":"John","Title":"","Surname":"Smith"}
{"FirstName":"Daniel","Title":"","Surname":"Smith"}
I'd like to loop through this JSON in a PHP script so my output is ultimately:
John Smith
Daniel Smith
My current PHP code is:
$fn = fopen("./test.txt","r");
while(! feof($fn)) {
$line = fgets($fn);
// grab data from JSON
}
fclose($fn);
How would I grab each element & output it in my page?