array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'zh', ), 'this' => array ( 0 => 'tidynode.getnextsibling.php', 1 => 'tidyNode::getNextSibling', 2 => 'Returns the next sibling node of the current node', ), 'up' => array ( 0 => 'class.tidynode.php', 1 => 'tidyNode', ), 'prev' => array ( 0 => 'tidynode.construct.php', 1 => 'tidyNode::__construct', ), 'next' => array ( 0 => 'tidynode.getparent.php', 1 => 'tidyNode::getParent', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/tidy/tidynode/getnextsibling.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

tidyNode::getNextSibling

(PHP 8 >= 8.4.0)

tidyNode::getNextSiblingReturns the next sibling node of the current node

说明

public tidyNode::getNextSibling(): ?tidyNode

Returns the next sibling node of the current node.

参数

此函数没有参数。

返回值

Returns a tidyNode if the node has a next sibling, or null otherwise.

示例

示例 #1 tidyNode::getNextSibling() example

<?php

$html
= <<< HTML
<html>
<head>
</head>
<body>
<p>Hello</p><p>World</p>
</body>
</html>

HTML;


$tidy = tidy_parse_string($html);

$node = $tidy->body();
var_dump($node->child[0]->getNextSibling()->value);

?>

以上示例会输出:

string(13) "<p>World</p>
"

参见