Filter a variable with the specified filter in PHP

Description

The following code shows how to filter a variable with the specified filter.

Example


  /*from  w w  w .  j a  va  2 s .  c  om*/
<?php
    if(!filter_var("someone@example....com", FILTER_VALIDATE_EMAIL)){
       echo("E-mail is not valid");
    }else{
       echo("E-mail is valid");
    }
?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    Data Types »




Array
Array Associative
Array Util
ArrayObject
Data Types
Date
Date Format
DateTime
Number
String
String Escape
String Filter
String HTML
String Type
Timezone