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

Posted:

Latest Articles

Magento 2 Releases Evolution - Features, Popularity & Issues

Magento 2

A Comprehensive Guide to Major Releases of Magento 2

Explore the evolution of Magento 2 through its major releases, detailing features added, popularity metrics, and issues encountered.

How to Install NordLayer VPN Client on Ubuntu 20.04 and Connect to a Virtual Network

Linux

How to Install NordLayer VPN Client on Ubuntu 20.04 and Connect to a Virtual Network

A simple to follow installation guide for NordLayer VPN

Mastering MySQL Database Imports on Linux - A Comprehensive Guide

MySQL

Mastering MySQL Database Imports on Linux

Learn efficient ways to import MySQL databases on Linux using the mysql command-line client. Explore the --source option and < operator for seamless data migration. Master MySQL imports on Linux with our comprehensive guide.