You are here

function dump_html_tree in simplehtmldom API 6

Same name and namespace in other branches
  1. 5.2 simplehtmldom/simple_html_dom.php \dump_html_tree()
  2. 7 simplehtmldom/simple_html_dom.php \dump_html_tree()
1 call to dump_html_tree()
simple_html_dom_node::dump in simplehtmldom/simple_html_dom.php

File

simplehtmldom/simple_html_dom.php, line 51

Code

function dump_html_tree($node, $show_attr = true, $deep = 0) {
  $lead = str_repeat('    ', $deep);
  echo $lead . $node->tag;
  if ($show_attr && count($node->attr) > 0) {
    echo '(';
    foreach ($node->attr as $k => $v) {
      echo "[{$k}]=>\"" . $node->{$k} . '", ';
    }
    echo ')';
  }
  echo "\n";
  foreach ($node->nodes as $c) {
    dump_html_tree($c, $show_attr, $deep + 1);
  }
}