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

tidyNode::getPreviousSibling

(PHP 8 >= 8.4.0)

tidyNode::getPreviousSiblingReturns the previous sibling node of the current node

Опис

public tidyNode::getPreviousSibling(): ?tidyNode

Returns the previous sibling node of the current node.

Параметри

У цієї функції немає параметрів.

Значення, що повертаються

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

Приклади

Приклад #1 tidyNode::getPreviousSibling() 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[1]->getPreviousSibling()->value);

?>

Поданий вище приклад виведе:

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

Прогляньте також