tidyNode::isText

(PHP 5, PHP 7, PHP 8)

tidyNode::isTextChecks if a node represents text (no markup)

Description

publictidyNode::isText(): bool

Tells if the node represents a text (without any markup).

Parameters

This function has no parameters.

Return Values

Returns true if the node represent a text, false otherwise.

Examples

Example #1 Extract text from a mixed HTML document

<?php

$html
= <<< HTML
<html><head>
<?php echo '<title>title</title>'; ?>
<#

alert('Hello World');
#>
</head>
<body>

<?php

The above example will output:

# text node #1 Hello World # text node #2 Outside HTML
To Top