Quantcast
Channel: XML To array in php - Stack Overflow
Viewing all articles
Browse latest Browse all 3

Answer by Sofiene Djebali for XML To array in php

$
0
0

You can achieve this using the simplexml_load_string() function

PHP

$xml = simplexml_load_string('MY_XML_CONTENT', "SimpleXMLElement", LIBXML_NOCDATA);$json = json_encode($xml);$array = json_decode($json,TRUE);var_dump($array);

var_dump should output :

array(1) {  ["CreateContact"]=>  array(1) {    ["pram"]=>    array(2) {      ["OfficePhoneNumber"]=>      string(10) "8387909727"      ["EmailAddress"]=>      string(21) "asheesh9308@gmail.com"    }  }}

Here is a EvalIN


Viewing all articles
Browse latest Browse all 3

Trending Articles