/ PHP

Previous Article

PHP Email Address Validation Function

Next Article

If you want to make sure that an email passed in a form or url variable is actually what you expect it to be then this function can help.

function is_email($email) {
    return preg_match('/^[a-z0-9!#$%&\'*+\/=?^`{}|~_-]+[.a-z0-9!#$%&\'*+\/=?^`{}|~_-]*@[a-z0-9]+[._a-z0-9-]*\.[a-z0-9]+$/ui', $email);
}

It simply returns true if the supplied is an email address and nothing (false) if the data passed into it isn't one.

Avatar of Clive Walkden

Clive Walkden

Latest Articles

Linux

Output All Users Cron Jobs

If you want to check all users cron jobs this little command will output them to the command line

Magento 2

Magento 2 admin password history reset

Do you want to clear the password history on your staging test site (not recommended for live)?

Linux

How to see files changed on a certain date

As a sysadmin you often need to see which files have been modified on a certain date.