/ 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 command line tools, installations etc

Linux

Terraform Installation

A quick installation guide for Terraform on Ubuntu 18.04

Bitcoin - Cryptocurrency not just for geeks

Bitcoin

RollerCoin Intro

An introduction to the RollerCoin site and how you can use it to mine your own coins

Magento 2 Blog Posts

Magento 2

Magento 2.4.x Writing to a Log File

How to log to information to a file in different Magento 2.4.x versions