fork download
  1. <?php
  2. $_json = '{ "DeviceTicketInfo":{ "UserId":27, "Ticket ":18005956, "DevInfo ": "sunsoft-123456 "}, "AvailableStations ":[{ "Id ":2, "No ":2, "Name ": "01-SUNSOFT "}]}';
  3. $_json = json_decode($_json);
  4. print_r($_json->DeviceTicketInfo->UserId);
  5.  
  6. echo "\n# Associative Array Example #\n";
  7.  
  8. $_json = '{ "DeviceTicketInfo":{ "UserId":27, "Ticket ":18005956, "DevInfo ": "sunsoft-123456 "}, "AvailableStations ":[{ "Id ":2, "No ":2, "Name ": "01-SUNSOFT "}]}';
  9. $_json = json_decode($_json, true);
  10. print_r($_json['DeviceTicketInfo']['UserId']);
Success #stdin #stdout 0.02s 23700KB
stdin
Standard input is empty
stdout
27
# Associative Array Example #
27