PHP 8.3.4 Released!

tidyNode::hasSiblings

(PHP 5, PHP 7, PHP 8)

tidyNode::hasSiblings Indique si le nœud a des frères

Description

public tidyNode::hasSiblings(): bool

Indique si le nœud courant a des nœuds frères.

Liste de paramètres

Cette fonction ne contient aucun paramètre.

Valeurs de retour

Retourne true si le nœud a des frères, false sinon.

Exemples

Exemple #1 Exemple avec tidyNode::hasSiblings()

<?php

$html
= <<< HTML
<html><head>
<?php echo '<title>title</title>'; ?>
<#
/* code JSTE */
alert('Hello World');
#>
</head>
<body>

<?php
// code PHP
echo 'hello world!';
?>

<%
/* code ASP */
response.write("Hello World!")
%>

<!-- Comments -->
Hello World
</body></html>
Outside HTML
HTML;


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

// La balise html
var_dump($tidy->html()->hasSiblings());

// La balise head
var_dump($tidy->html()->child[0]->hasSiblings());

?>

L'exemple ci-dessus va afficher :

bool(false)
bool(true)

add a note

User Contributed Notes

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