simplehtmldom_1_5\simple_html_dom_node::dump_node PHP Method

dump_node() public method

Debugging function to dump a single dom node with a bunch of information about it.
public dump_node ( $echo = true )
    function dump_node($echo = true)
    {
        $string = $this->tag;
        if (count($this->attr) > 0) {
            $string .= '(';
            foreach ($this->attr as $k => $v) {
                $string .= "[{$k}]=>\"" . $this->{$k} . '", ';
            }
            $string .= ')';
        }
        if (count($this->_) > 0) {
            $string .= ' $_ (';
            foreach ($this->_ as $k => $v) {
                if (is_array($v)) {
                    $string .= "[{$k}]=>(";
                    foreach ($v as $k2 => $v2) {
                        $string .= "[{$k2}]=>\"" . $v2 . '", ';
                    }
                    $string .= ")";
                } else {
                    $string .= "[{$k}]=>\"" . $v . '", ';
                }
            }
            $string .= ")";
        }
        if (isset($this->text)) {
            $string .= " text: (" . $this->text . ")";
        }
        $string .= " HDOM_INNER_INFO: '";
        if (isset($node->_[HDOM_INFO_INNER])) {
            $string .= $node->_[HDOM_INFO_INNER] . "'";
        } else {
            $string .= ' NULL ';
        }
        $string .= " children: " . count($this->children);
        $string .= " nodes: " . count($this->nodes);
        $string .= " tag_start: " . $this->tag_start;
        $string .= "\n";
        if ($echo) {
            echo $string;
            return;
        } else {
            return $string;
        }
    }