php8.5
Home/ Manual/ tidy / tidy/ tidy::head

tidy::head

PHP function Edit on GitHub ✎

Returns a tidyNode object starting from the <head> tag of the tidy parse tree

Description

Oop

tidy::head(): tidyNode|null

Procedural

tidy_get_head(tidy $tidy): tidyNode|null

Returns a tidyNode object starting from the <head> tag of the tidy parse tree.

Parameters

tidy

Object

Return Values

Returns the tidyNode object.

Examples

tidy::head() example

php
<?php
$html = '
<html>
  <head>
    <title>test</title>
  </head>
  <body>
    <p>paragraph</p>
  </body>
</html>';

$tidy = tidy_parse_string($html);

$head = $tidy->head();
echo $head->value;
?>

The above example will output:

output
<head>
<title>test</title>
</head>

See Also

Source: reference/tidy/tidy/head.xml · from the official PHP manual (php/doc-en)