Tag Archives: simplexml

simplexml to array

Sometimes dealing with PHP’s simplexml object can be annoying, and you just wish it was a simple array. There are a ton of functions out there for that, but I’ve found this one works best =) Source: http://www.php.net/manual/en/ref.simplexml.php function simplexml2array($xml) { if (get_class($xml) == ‘SimpleXMLElement’) { $attributes = $xml->attributes(); foreach($attributes as $k=>$v) { if ($v) […]