Question

I am decoding a json record in php, here is the structure :

{relations":[], "entity":
 {"ide":1045, "status":"normal"}
}

Then my php code is : $result = json_decode($json, true);

How to reach "ide" and "status" values from the array $result ?

Thanks a lot

Pas de solution correcte

Autres conseils

Since you specified in json_decode that you want to have an associative array you can echo your data like this:

echo $result['entity']['ide'];
echo $result['entity']['status'];

With the second value set to true, your variables are in an array and so:

$result['entity']['ide'];
$result['entity']['status'];

If you miss out the true argument, your values would be in an object:

$result->entity->ide;
$result->entity->status;
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top