pQuery\DomNode::childCount PHP Method

childCount() public method

Number of children in node
public childCount ( boolean $ignore_text_comments = false ) : integer
$ignore_text_comments boolean Ignore text/comments with calculation
return integer
    function childCount($ignore_text_comments = false)
    {
        if (!$ignore_text_comments) {
            return count($this->children);
        } else {
            $count = 0;
            //foreach($this->children as &$c) {
            //	if (!$c->isTextOrComment()) {
            //		++$count;
            //	}
            //}
            foreach (array_keys($this->children) as $k) {
                if (!$this->children[$k]->isTextOrComment()) {
                    ++$count;
                }
            }
            return $count;
        }
    }
DomNode