filter_string()

function filter_string(string $string, array $allowed_tags = []): string

Deprecated: This function is deprecated and will be removed from the Trongate framework on June 3, 2026. Developers are encouraged to replace instances of filter_string() with filter_str() throughout their applications.

Description

An alias for filter_str() retained for backward compatibility. Filters and sanitizes a string by removing potentially harmful content while optionally preserving specified HTML tags.

Parameters

Parameter Type Description Default
$string string The input string to be filtered and sanitized. N/A
$allowed_tags string[] An optional array of allowed HTML tags. []

Return Value

Type Description
string The filtered and sanitized string.