Skip to content

Instantly share code, notes, and snippets.

@mathewjosephh
Created June 9, 2015 05:17
Show Gist options
  • Save mathewjosephh/1c3ebfdd97af37b150bf to your computer and use it in GitHub Desktop.
Save mathewjosephh/1c3ebfdd97af37b150bf to your computer and use it in GitHub Desktop.
<?php
$myXMLData =
"<?xml version='1.0' encoding='UTF-8'?>
<myxml>
<entry>
<string>actiontypedesc</string>
<string>Registration of google1231.com for 1 year</string>
</entry>
<entry>
<string>unutilisedsellingamount</string>
<string>-1531.770</string>
</entry>
<entry>
<string>sellingamount</string>
<string>-1531.770</string>
</entry>
<entry>
<string>entityid</string>
<string>57928339</string>
</entry>
<entry>
<string>actionstatus</string>
<string>Success</string>
</entry>
</myxml>";
$json = json_decode(json_encode(simplexml_load_string($myXMLData)), true);
// json_encode() & json_decode() is to convert object to array
print '<pre>';
print_r($json);
print '</pre>';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment