filter_data

(no version information, might be only in CVS)

filter_data -- Filters data with a specified filter

Opis

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

Ostrzeżenie

Ta funkcja jest w stadium EKSPERYMENTALNYM. Oznacza to, że zachowanie funkcji, jej nazwa, w zasadzie wszystko udokumentowane tutaj może zostać zmienione w przyszłych wersjach PHP bez wcześniejszego uprzedzenia. Używaj tej funkcji na własne ryzyko.

Parametry

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.

Zwracane wartości

Returns filtered data or NULL if filter fails.

Przykłady

Przykład 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));
?>

Powyższy przykład wyświetli:

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

Patrz także

input_get()
informacje o typie callback