Hi I trying to convert an XML file into a php array, all the nodes becomes well except this one.
<category name="Wheels and Tires">
<specification name="Front Tire Type">P245/40R18</specification>
<specification name="Front Wheel Diameter">18.0 x 8.0</specification>
<specification name="Rear Tire Type">P245/40R18</specification>
<specification name="Rear Wheel Diameter">18.0 x 8.0</specification>
</category>
The problem is that the attribute name is gone from the array, any idea why, thank you in advance.. here is my code and the array result.
$xml = curl_exec($ch); // $result now contains the response JSON or XML.
$xml_string = simplexml_load_string($xml);
$json = json_encode($xml_string);
$xml_parse = json_decode($json, TRUE);
return($xml_parse);
array:2 [▼
"@attributes" => array:1 [▶]
"specification" => array:4 [▼
0 => "P245/40R18"
1 => "18.0 x 8.0"
2 => "P245/40R18"
3 => "18.0 x 8.0"
]
]