I look around interwebz for a simple answer, but cannot find. So the question is:
I am going to decrypt some JSON to find out if a value exists; although, I donβt think I am doing it right. I want to check if appid value exists: 730.
Here's the JSON:
{ response: { game_count: 106, games: [ { appid: 10, playtime_forever: 67 }, { appid: 730, playtime_forever: 0 }, { appid: 368900, playtime_forever: 0 }, { appid: 370190, playtime_forever: 0 }, ] } }
This is what I want:
$json = file_get_contents('JSON URL HERE'); $msgArray = json_decode($json, true); if (appid: 730 exists) { ... }
Thanks, I hope I have explained enough.
source share