Convert xml data (SimpleXMLElement object) to array
Definition at line 11 of file Xml.php.
◆ xmlToAssoc()
xmlToAssoc |
( |
\SimpleXMLElement |
$xml | ) |
|
Transform \SimpleXMLElement to associative array \SimpleXMLElement must be conform structure, generated by assocToXml()
- Parameters
-
- Returns
- array
Definition at line 20 of file Xml.php.
23 foreach ($xml as $key =>
$value) {
24 if (isset(
$value->{$key})) {
26 foreach (
$value->{$key} as $v) {
27 $array[$key][
$i++] = (string)$v;
31 $array[$key] = trim((
string)
$value);
32 if (empty($array[$key]) && !empty(
$value)) {
36 $array[$key] = (string)
$value;
xmlToAssoc(\SimpleXMLElement $xml)
The documentation for this class was generated from the following file:
- vendor/magento/framework/Convert/Xml.php