Skip to content

Commit 602470b

Browse files
committed
IHF: xml_to_array helper added.
1 parent 3f5c07b commit 602470b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/xml.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
if (!function_exists('xml_to_array')) {
4+
function xml_to_array($xml)
5+
{
6+
$xml = ($xml instanceof SimpleXMLElement) ? $xml : new SimpleXMLElement($xml);
7+
8+
return json_decode(json_encode($xml), true);
9+
}
10+
}

0 commit comments

Comments
 (0)