Miifor
Miifor

Reputation: 21

Pear Email Validation

I am trying to create a simple webstore which has a couple of forms which customers need to fill. After they are filled, I validate them using Pear Validate.php.

$validate = new Validate();

$options = array("check_domain"=>true,"use_rfc822"=>true);

$test = $validate->email("$epost",$ehdot);
if (!($test)) {
    $checks = false;
    echo 'EMAIL IS WRONG </p>';

}

$epost being the email customer inserts into a email form. For some reason, it throws an error like this:

Strict Standards: Only variables should be passed by 
reference in /home2-3/e/anon/public_html/php/verkkostore/Validate.php on line 586

Here is the code from Validate.php from line 586

$domain = preg_replace('/[^-a-z.0-9]/i', '', array_pop(explode('@', $email)));

Thanks in advance!

Upvotes: 1

Views: 214

Answers (1)

Miifor
Miifor

Reputation: 21

Okay this is how I fixed it. Thank you for your help, it got me on a right path!

$array = explode('@', $email);
$pop = array_pop($array);
$domain = preg_replace('/[^-a-z.0-9]/i', '', $pop);

Upvotes: 1

Related Questions