Overview
KB
Technical FAQ
PHP Manual
CSS2 Manual
HTML Manual
JS Guide
JS Reference
PhpDock Manual
Nu-Coder Manual
PhpExpress Manual
PHP Joomla
Development
Learn PHP
 
<Filterinput_filters_list>
Last updated: Tue, 19 Sep 2006

filter_data

(no version information, might be only in CVS)

filter_data -- Filters data with a specified filter

Description

mixed filter_data ( mixed variable, int filter [, mixed filter_options [, string charset]] )

Warning

This function is EXPERIMENTAL. The behaviour of this function, the name of this function, and anything else documented about this function may change without notice in a future release of PHP. Use this function at your own risk.

Parameters

variable

Value to filter, arrays are filtered recursively.

filter

ID of a filter to use.

filter_options

Associative array of options or bitwise disjunction of flags. If filter accepts options, flags can be provided in "flags" field of array. For the "callback" filter, callback type should be passed.

charset

Character set used for filtering. Currently no filter uses this parameter.

Return Values

Returns the filtered data, or FALSE if the filter fails.

Examples

Example 1. A filter_data() example

<?php
var_dump(filter_data('bob@example.com', FILTER_VALIDATE_EMAIL));
var_dump(filter_data('example.com', FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED));
?>

The above example will output:

string(15) "bob@example.com"
bool(false)

See Also

input_get()
information about the callback type




<Filterinput_filters_list>
Last updated: Tue, 19 Sep 2006