CakeFest 2024: The Official CakePHP Conference

tidyNode::hasSiblings

(PHP 5, PHP 7, PHP 8)

tidyNode::hasSiblingsIndica si un nodo tiene hermanos

Descripción

public tidyNode::hasSiblings(): bool

Indica si un nodo tiene hermanos.

Parámetros

Esta función no tiene parámetros.

Valores devueltos

Devuelve true si un nodo tiene hermanos, false de lo contrario.

Ejemplos

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)

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top