Frage

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

Keine korrekte Lösung

Andere Tipps

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;
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top