Menu
Folks,
Why is not my final IF condition getting triggered ? The php seems to miss that whole condition. Overlooks it. Why ?
[code]
<?php
$email = ‘asd’; //Testing with Invalid Email.
function validate_email($data = NULL)
{
$email_Error_Mssg = ”; //Local Variable.
if(!filter_var($data,FILTER_VALIDATE_EMAIL))
{
return $email_Error_Mssg = ‘Invalid Email!’;
//die; //Script still flows beyond this line. Remove this line.
}
else
{
return $filtered_email = $data;
}
}
echo validate_email($email);
echo ‘1’;
//Why following IF condition not triggering ?
if(!empty($email_Error_Mssg))
{
die(“B. $email_Error_Mssg”);
}
?>