Jump to content

Code explanation


coop

Recommended Posts

Hi all,

I have this function for checking valid emails but I'm a bit stuck with some of the code

[code]
function valid_email($email){
  // check if email is valid
  if( !eregi(“^[a-z0-9]+([_\\.-][a-z0-9]+)*”.”@([a-z0-9]+([\.-][a-z0-9]+))*$”,$email, $regs)){
    return false;
  } else if( gethostbyname($regs[2]) == $regs[2] ){
      // if host is invalid
      return false;
  } else {
      return true;
  }
}
[/code]

it's this bit I dont understand
[code]
!eregi(“^[a-z0-9]+([_\\.-][a-z0-9]+)*”.”@([a-z0-9]+([\.-][a-z0-9]+))*$”,$email, $regs)
[/code]

I know eregi is the case insensitive regular expression match, but it's the rest I dont understand, could someone explain.
Link to comment
https://forums.phpfreaks.com/topic/31992-code-explanation/
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.