0
$userinfo = {"userdata":{"usertarget":{"id":12345,"name":"John Doe","status":"user"}}}

for example, that was the result i got and call it as userinfo, and now how can i find the specific word from userinfo such as like "name":"John Doe" and then echo it

like

$userinfo = {"userdata":{"usertarget":{"id":12345,"name":"John Doe","status":"user"}}}
$find = ... //find "name":"John Doe" from $userinfo
echo $find;
Tunku Salim
  • 167
  • 1
  • 9
  • 2
    Does this answer your question? [How do I extract data from JSON with PHP?](https://stackoverflow.com/questions/29308898/how-do-i-extract-data-from-json-with-php) – stud3nt Dec 26 '19 at 03:44
  • 2
    first you need to decode your json json_decode($userinfo, true) to array – Saf Dec 26 '19 at 04:00
  • i tried $find = json_encode($userinfo); echo $find->userdata->usertarget->name; but it echoing nothing – Tunku Salim Dec 26 '19 at 04:18

0 Answers0