public function toArray(SimpleXMLElement $xml = null)
	{
		if ($xml === null) {
			$xml = $this->xml;
		}

		if (!$xml->children()) {
			return (string) $xml;
		}

		$arr = array();
		foreach ($xml->children() as $tag => $child) {
			if (count($xml->$tag) === 1) {
				$arr[$tag] = $this->toArray($child);
			} else {
				$arr[$tag][] = $this->toArray($child);
			}
		}

		return $arr;
	}
public function toArray(SimpleXMLElement $xml = null)
	{
		if ($xml === null) {
			$xml = $this->xml;
		}

		if (!$xml->children()) {
			return (string) $xml;
		}

		$arr = array();
		foreach ($xml->children() as $tag => $child) {
			if (count($xml->$tag) === 1) {
				$arr[$tag] = $this->toArray($child);
			} else {
				$arr[$tag][] = $this->toArray($child);
			}
		}

		return $arr;
	}
public function toArray ( SimpleXMLElement $ xml = null ) { if ( $ xml === null ) { $ xml = $ this -> xml ; } if ( ! $ xml -> children ( ) ) { return ( string ) $ xml ; } $ arr = array ( ) ; foreach ( $ xml -> children ( ) as $ tag => $ child ) { if ( count ( $ xml -> $ tag ) === 1 ) { $ arr [ $ tag ] = $ this -> toArray ( $ child ) ; } else { $ arr [ $ tag ] [ ] = $ this -> toArray ( $ child ) ; } } return $ arr ; }
Converts a SimpleXMLElement into an array.
@param  SimpleXMLElement
@return array
Converts a SimpleXMLElement into an array .