<?php
$str = "<h1>Hello World!</h1>";
$newstr = filter_var($str, FILTER_SANITIZE_STRING);
echo $newstr;
?>
// filter_var() function used to filters a variable
//with the help of a specified filter .
// in php language we use filter_var() To validate data such as email , ipAdress .etc.
// syntax is filte_var($varName , FILTER_VALIDATE_EMAIL );
//example
$email ="test@gmail.com";
if(filter_var($email, FILTER_VALIDATE_EMAIL){
echo" email adresse is valid ";
else{
echo " the email adresse is not valid " ; }
var_dump(filter_var('bob@example.com', FILTER_VALIDATE_EMAIL));
var_dump(filter_var('http://example.com', FILTER_VALIDATE_URL, FILTER_FLAG_PATH_REQUIRED));