Cleans (sanitizes), an array or object by passing one or more filters to each element. The function works recursively, so it is valid for arrays and multidimensional objects.

It always returns an array, so it can also be used to convert multi-dimensional objects into arrays.


Data: Array or object to be "sanitized".
Filter: One or more of the following filters separated by spaces; html sql shell strip strip

If $filter is omitted the default value is strip.

html: Escape html tags
sql: Prepares SQL statements (became obsolete when switching to PDO)
shell: Escape arguments from the shell
strip: Remove any tag, link or multiline comment

Translated with