Phpfilter_var specify data filtering _ PHP Tutorial

Source: Internet
Author: User
Phpfilter_var filters specified data. Define and use the filter of the filter_var () function and the filter specified by a variable. A success or a failure of FALSE is returned. Syntax filter_var (variable, filter, opti definition and usage
The filter of the filter_var () function and the filter specified by a variable.

A success or a failure of FALSE is returned.

Syntax

filter_var(variable, filter, options)
 

Variable: required. Filter: Optional. Specify the number of filters to use. The default value is FILTER_SANITIZE_STRING.

Check whether PHP filters are completely possible. refer to the filters. the filter number can be a number name (such as FILTER_VALIDATE_EMAIL) or an ID number (such as 274) options: Optional. Specify the flag/option of an associated array or a single flag/option. Check various possible options and flags for each filter

Let's take a look at the filter_var instance tutorial.

If (! Filter_var ("someone @ example....com", FILTER_VALIDATE_EMAIL) {echo ("E-mail is not valid ");} else {echo ("E-mail is valid") ;}?>

Output result.

E-mail is not valid

Filters the filter_var () function and the filter specified by a variable. A success or a failure of FALSE is returned. Syntax filter_var (variable, filter, opti...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.