array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'es', ), 'this' => array ( 0 => 'tidynode.hassiblings.php', 1 => 'tidyNode::hasSiblings', ), 'up' => array ( 0 => 'class.tidynode.php', 1 => 'tidyNode', ), 'prev' => array ( 0 => 'tidynode.haschildren.php', 1 => 'tidyNode::hasChildren', ), 'next' => array ( 0 => 'tidynode.isasp.php', 1 => 'tidyNode::isAsp', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'es', 'path' => 'reference/tidy/tidynode/hassiblings.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 5, PHP 7, PHP 8)
tidyNode::hasSiblings — Indica si un nodo tiene hermanos
Esta función no tiene parámetros.
Ejemplo #1 Ejemplo de tidyNode::hasSiblings()
<?php
$html = <<< HTML
<html><head>
<?php echo '<title>titulo</title>'; ?>
<#
/* código JSTE */
alert('Hola Mundo');
#>
</head>
<body>
<?php
// código PHP
echo 'Hola Mundo!';
?>
<%
/* código ASP */
response.write("Hola Mundo!")
%>
<!-- Comentarios -->
Hola Mundo
</body></html>
Fuera del HTML
HTML;
$tidy = tidy_parse_string($html);
$num = 0;
// La etiqueta HTML
var_dump($tidy->html()->hasSiblings());
// La etiqueta HEAD
var_dump($tidy->html()->child[0]->hasSiblings());
?>
El resultado del ejemplo sería:
bool(false) bool(true)