I've been trying to mess around with some JSON data for an idea that I have, but when I try to foreach loop through the JSON, it's only returns the first character for all the data and not just the first_name in my test.
Code
<?php
$jsondata ='{"first_name":"John","last_name":"Doe","guest_link":"test test","id":"3"}';
$json = json_decode($jsondata, true);
?>
<?php foreach($json as $item) : ?>
<p>
<?php echo $item['first_name']; ?>
</p>
<?php endforeach; ?>
Result
J
D
t
3
If I do a var_dump this is what I get:
string(4) "John"
string(3) "Doe"
string(9) "test test"
string(1) "3"
So, I'm not sure if I'm missing something, or if I'm just going about this the wrong way.