How to use filter functions in PHP

In this article I will go to explain about PHP filter functions.
  • 2300

Functions  of PHP filters

PHP filter is used to validate and filter data coming from insecure
mediums. There are the following function of PHP filter:

  • Filter var array function of PHP

    It is used to validate and filter a several variable with a same or different  filter.

Syntax of filter var array function

filter_var_array(array $data, mixed $ definition);

  • Filter var function of PHP

    It is used to validate and filter a single variable with a specified filter.

Syntax of filter var function

filter_var(mixed $variable, int $filter=Filter_default);

Example of  filter var function

<html>

<body>

<?php

if(!filter_var('[email protected]', FILTER_VALIDATE_EMAIL))

  {

  echo("It is not a E-mail");

  }

else

  {

  echo("It is valid E-mail");

  }

?>

</body>

</html>


Output:

var function.jpg

You may also want to read these related articles :here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

© 2020 DotNetHeaven. All rights reserved.