public static function getChildElements($element, $withText = false)
    {
        $children = $element->childNodes;
        $returnValue = array();
        
        for ($i = 0; $i < $children->length; $i++) {
            if ($children->item($i)->nodeType === XML_ELEMENT_NODE || ($withText === true && ($children->item($i)->nodeType === XML_TEXT_NODE || $children->item($i)->nodeType === XML_CDATA_SECTION_NODE))) {
                $returnValue[] = $children->item($i);
            }
        }
        
        return $returnValue;
    }
public static function getChildElements($element, $withText = false)
    {
        $children = $element->childNodes;
        $returnValue = array();
        
        for ($i = 0; $i < $children->length; $i++) {
            if ($children->item($i)->nodeType === XML_ELEMENT_NODE || ($withText === true && ($children->item($i)->nodeType === XML_TEXT_NODE || $children->item($i)->nodeType === XML_CDATA_SECTION_NODE))) {
                $returnValue[] = $children->item($i);
            }
        }
        
        return $returnValue;
    }
public static function getChildElements ( $ element , $ withText = false ) { $ children = $ element -> childNodes ; $ returnValue = array ( ) ; for ( $ i = 0 ; $ i < $ children -> length ; $ i ++ ) { if ( $ children -> item ( $ i ) -> nodeType === XML_ELEMENT_NODE || ( $ withText === true && ( $ children -> item ( $ i ) -> nodeType === XML_TEXT_NODE || $ children -> item ( $ i ) -> nodeType === XML_CDATA_SECTION_NODE ) ) ) { $ returnValue [ ] = $ children -> item ( $ i ) ; } } return $ returnValue ; }
Get the children DOM Nodes with nodeType attribute equals to XML_ELEMENT_NODE.

@param DOMElement $element A DOMElement object.
@param boolean $withText Wether text nodes must be returned or not.
@return array An array of DOMNode objects.
Get the children DOM Nodes with nodeType attribute equals to XML_ELEMENT_NODE .