想用php [重复]从json结果中获取一个值

This question already has an answer here:

How can i get ID value only

like

$fo = "11890408";

{"success":true,"result":{"success":[{"id":"11890408","device_id":"17183","message":"okey","status":"pending","send_at":1455046054,"queued_at":0,"sent_at":0,"delivered_at":0,"expires_at":1455049654,"canceled_at":0,"failed_at":0,"received_at":0,"error":"","created_at":1455046054,"contact":{"id":"2522330","name":"923336458112","number":"923336458112"}}],"fails":[]}}
</div>

Convert the json string to a php data structure and then navigate through the data tree of objects and arrays:

$json = '{
  "success":true,
  "result":{
    "success[
      {
        "id":"11890408",
        "device_id":"17183",
        "message":"okey",
        "status":"pending",
        "send_at":1455046054,
        "queued_at":0,
        "sent_at":0,
        "delivered_at":0,
        "expires_at":1455049654,
        "canceled_at":0,
        "failed_at":0,
        "received_at":0,
        "error":"",
        "created_at":1455046054,
        "contact":{
          "id":"2522330",
          "name":"923336458112",
          "number":"923336458112"
        }
      }
    ],
    "fails":[]
  }
}';

$data = json_decode($json);
$fo = $data->result->success[0]->id;