PHP 8.3.4 Released!

tidyNode::hasSiblings

(PHP 5, PHP 7, PHP 8)

tidyNode::hasSiblingsこのノードが兄弟ノードを持つかどうかを調べる

説明

public tidyNode::hasSiblings(): bool

ノードが兄弟ノードを持つかどうかを調べます。

パラメータ

この関数にはパラメータはありません。

戻り値

兄弟ノードを持つ場合に true、それ以外の場合に false を返します。

例1 tidyNode::hasSiblings() の例

<?php

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

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

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

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


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

// the html tag
var_dump($tidy->html()->hasSiblings());

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

?>

上の例の出力は以下となります。

bool(false)
bool(true)

add a note

User Contributed Notes

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