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]] )

Waarschuwing

Deze functie is EXPERIMENTEEL. Dat betekent, dat het gedrag van deze functie, deze functienaam, in concreto ALLES dat hier gedocumenteerd is in een toekomstige uitgave van PHP ZONDER WAARSCHUWING kan veranderen. Wees gewaarschuwd, en gebruik deze functie op eigen risico.

Parameters

variable

Value to filter, arrays are filtered resursivelly.

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 filtered data or NULL if filter fails.

Voorbeelden

Voorbeeld 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));
?>

Het resultaat van dit script is als volgt:

string(15) "bob@example.com"
NULL

Zie ook

input_get()
informatie over het callback type