fork(1) download
  1. <?php
  2.  
  3. $json = <<<__JSON
  4. {
  5. "barcode": {
  6. "message": "<?xml version=\"1.0\" encoding = \"utf-8\"?><PrintLetterBarcodeData name=\"ABCD\" gender=\"FEMALE\" yob=\"1964\"/>",
  7. "format": "PKBarcodeFormatQR",
  8. "messageEncoding": "iso-8859-1"
  9. }
  10. }
  11. __JSON;
  12.  
  13. $json = json_decode($json);
  14. $xml = simplexml_load_string($json->barcode->message);
  15. echo $xml['name'].' '. $xml['gender'].' '. $xml['yob'];
  16.  
Success #stdin #stdout 0.01s 20520KB
stdin
Standard input is empty
stdout
ABCD FEMALE 1964