Fatal error: Call to undefined function filter_var()
http://php.net/manual/en/function.filter-var.php
This function is available only for PHP 5 >= 5.2.0
http://php.net/manual/en/filter.filters.sanitize.php
http://php.net/manual/en/function.filter-var.php
This function is available only for PHP 5 >= 5.2.0
http://php.net/manual/en/filter.filters.sanitize.php
<?php
/*fix for older php version*/
if (!function_exists('filter_var')){
define(FILTER_VALIDATE_EMAIL,'/^[A-Za-z0-9-_.+%]+@[A-Za-z0-9-.]+.[A-Za-z]{2,4}$/');
function filter_var($string, $filter_type) {
if ( preg_match( FILTER_VALIDATE_EMAIL, $string ) ) {
return true;
}
return false;
}
}
$val = 'argento@emailsamplex.com';
if (filter_var($val, FILTER_VALIDATE_EMAIL) === false) { die("$val wrong email");}
echo 'ok';
Comments
Post a Comment