# wp-optimize/4.7.0/vendor/simplehtmldom/simplehtmldom/docs/HtmlNode/text.md

WP-Optimize – Cache, Compress images, Minify &amp; Clean database to boost page speed &amp; performance, version 4.7.0. 23 lines.

- Page: https://pluginprobe.com/plugins/wp-optimize/4.7.0/code/vendor/simplehtmldom/simplehtmldom/docs/HtmlNode/text.md
- Raw: https://pluginprobe.com/plugins/wp-optimize/4.7.0/raw/vendor/simplehtmldom/simplehtmldom/docs/HtmlNode/text.md
- Modified: 2023-03-13T15:14:32+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/wp-optimize/4.7.0/code/vendor/simplehtmldom/simplehtmldom/docs/HtmlNode/text.md#L10-L20`.

````markdown
```php
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 descendants.

**Remarks**

* You can use the shorthand version [`$node->plaintext`](__get.md) instead of
`$node->text()` which also works on the document level (automatically selects
the root element of the document).

**Examples**

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