text ( [ bool $trim = true ] ) : string
Parameter Description
trim Removes whitespace around the text if enabled.

Returns the text representation of the current node and its decendants.

Remarks

  • You can use the short-hand version $node->plaintext instead of $node->text() which also works on the document level (automatically selects the root element of the document).

Examples

$node->text();
$node->plaintext;
$html->plaintext;