Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
Your IP : 3.145.2.6
---
title: text
---
```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 decendants.
**Remarks**
* You can use the short-hand 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;
```
|