tidyNode::getParent

(PHP 5 >= 5.2.2, PHP 7)

tidyNode::getParentDevuelve el nodo padre del nodo actual

Descripción

tidyNode::getParent ( void ) : tidyNode

Devuelve el nodo padre del nodo actualReturns the parent node of the current node.

Ejemplos

Ejemplo #1 Ejemplo de tidyNode::hasChildren()

<?php

$html 
= <<< HTML
<html><head>
<?php echo '<title>titulo</title>'; ?>
<# 
  /* código JSTE */
  alert('Hola Mundo'); 
#>
 </head>
 <body>
 Hola Mundo
 </body>
</html>

HTML;


$tidy tidy_parse_string($html);
$num 0;

$node $tidy->html()->child[0]->child[0];

var_dump($node->getparent()->name);
?>

El resultado del ejemplo sería:

string(4) "head"

Valores devueltos

Devuelve un tidyNode si el nodo tiene padre, o NULL de lo contrario.