Jump to content

PHP 5 to 7 ereg?


jefferis

Recommended Posts

I folks,  I have some old forms on client sites that broke with the upgrade to php 7.  I am wondering which PCRE to replace this following bit of code, which seems to be the only one in the form that is deprecated: 

function CheckEmail($email, $optional) {
 if ( (strlen($email) == 0) && ($optional === kOptional) ) {
  return true;
 } elseif ( eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$", $email) ) {
  return true;
 } else {
  return false;
 }
}

Just preg?   or one of these? diamond.php

 

I'm not doing much coding anymore. However, what happened was when the form was filled out and posted, instead of running the form's code, the actual php file downloaded.  

TIA,

Jeff 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.