Tuesday, April 14, 2009

Posted by khuyen at 7:07 AM

Functions and Filters

To filter a variable, use one of the following filter functions:

  • filter_var() - Filters a single variable with a specified filter
  • filter_var_array() - Filter several variables with the same or different filters
  • filter_input - Get one input variable and filter it
  • filter_input_array - Get several input variables and filter them with the same or different filters

In the example below, we validate an integer using the filter_var() function:

if(!filter_var($int, FILTER_VALIDATE_INT))
{
echo("Integer is not valid");
}
else
{
echo("Integer is valid");
}
?>

0 comments on " "

Post a Comment

 

girl thao can rat nhieu money nen cac ban click vao quang cao cho toi nhe Copyright 2009 Sweet Cupcake Designed by Ipiet Templates Blogger Styles Image by Tadpole's Notez