Skip to content

Commit

Permalink
Merge in ToString filter docs
Browse files Browse the repository at this point in the history
Signed-off-by: George Steel <[email protected]>
  • Loading branch information
gsteel committed Oct 31, 2024
1 parent 7656850 commit 1e560dc
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions docs/book/v3/standard-filters.md
Original file line number Diff line number Diff line change
Expand Up @@ -969,6 +969,27 @@ $filter = new Laminas\Filter\ToNull([

It is best practice is to use the `TYPE_*` constants rather than the human-readable strings. Modern IDEs will autocomplete these for you and usage and refactoring is easier.

## ToString

The `ToString` filter casts `Stringable` objects or scalar values to `string`.
This filter has no runtime options.

### Basic Usage

```php
$filter = new \Laminas\Filter\ToString();

$filter->filter(123); // "123"
```

Non-scalar input will be returned un-filtered:

```php
$filter = new \Laminas\Filter\ToString();

$filter->filter(['muppet' => 'Kermit']); // ['muppet' => 'Kermit']
```

## NumberFormat

The `NumberFormat` filter can be used to return locale-specific number and percentage strings. It
Expand Down

0 comments on commit 1e560dc

Please sign in to comment.