| 1 |
```php |
| 2 |
text ( [ bool $trim = true ] ) : string |
| 3 |
``` |
| 4 |
|
| 5 |
| Parameter | Description | |
| 6 |
|-----------|------------------------------------------------| |
| 7 |
| `trim` | Removes whitespace around the text if enabled. | |
| 8 |
|
| 9 |
Returns the text representation of the current node and its descendants. |
| 10 |
|
| 11 |
**Remarks** |
| 12 |
|
| 13 |
* You can use the shorthand version [](__get.md`$node->plaintext`](__get.md](__get.md) instead of |
| 14 |
`$node->text()` which also works on the document level (automatically selects |
| 15 |
the root element of the document). |
| 16 |
|
| 17 |
**Examples** |
| 18 |
|
| 19 |
```php |
| 20 |
$node->text(); |
| 21 |
$node->plaintext; |
| 22 |
$html->plaintext; |
| 23 |
``` |