Web студия "GrandView"
  Главная   Написать Контакты
   
   
О проекте
Руководство php
 

filter_var

(no version information, might be only in CVS)

filter_var -- Filters a variable with a specified filter

Описание

mixed filter_var ( mixed variable [, int filter [, mixed options]] )

Список параметров

variable

Value to filter, arrays are filtered recursively.

filter

ID of a filter to use. Defaults to FILTER_SANITIZE_STRING.

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.

Возвращаемые значения

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

Примеры

Пример 1. A filter_var() example

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

Результат выполнения данного примера:

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

Смотрите также

filter_var_array()
filter_input()
filter_input_array()
информация о типе callback



add a note add a note User Contributed Notes
filter_var
John
26-Jul-2007 12:35
I managed to get this to work with PHP 5.1.6 on CentOS 5 with minor difficulty.

1) Download the PECL filter package
2) Extract the tarball
3) phpize the directory
4) ./configure
5) make
6) filter-0.11.0/logical_filters.c:25:31: error: ext/pcre/php_pcre.h: No such file or directory
7) find / -name php_pcre.h
8) Make sure php-devel is installed
9) Edit filter-0.11.0/logical_filters.c and replace "ext/pcre/php_pcre.h" with the absolute path of php_pcre.h
10) make
11) make install
12) add "extension=filter.so" to php.ini
13) Restart Apache
menic [monkey] o2 . pl
25-May-2007 10:46
I dont know why, but this function doesn't work properly with array as $variable. To make it work I suggest to use foreach, and filter each value in this way.

Firebird/InterBase> <filter_var_array
Last updated: Sat, 27 Jan 2007
 
 
Новости
11 июля 2007
Сайт запущен
© 2007 info@grandviewstudio.com

Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/sites/grandviewstudiocom/www/65f67d67a94ad980786580ae69e11c07/sape.php on line 324

Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/sites/grandviewstudiocom/www/65f67d67a94ad980786580ae69e11c07/sape.php on line 330
Z058440144362 Z348613067571