filter_name()
function filter_name(string $name, array $allowed_chars = []): string
Description
Filters and sanitizes a name string by removing characters that are not typically valid in personal or business names. An optional array of additional allowed characters can be specified to accommodate edge cases.
Parameters
| Parameter | Type | Description | Default |
|---|---|---|---|
| $name | string | The input name to be filtered and sanitized. | N/A |
| $allowed_chars | string[] | An optional array of additional allowed characters beyond the default set. | [] |
Return Value
| Type | Description |
|---|---|
| string | The filtered and sanitized name string. |