Location: PHPKode > scripts > a_email > a_email/class.a_email.php
<?php
/**
 * a_email - Version 0.5
 * 2005-11-18
 *
 * Class to store an email address
 * - Checks whether email address is valid - properly formatted
 *
 * N.B. 'a' in 'a_email' stands for Alberon not the pronoun!
 *
 * Created by Toby Weiss
 * hide@address.com
 * Copyright Alberon Systems 2005
 */
class a_email
{
	/**
	 * Variable to store email address
	 *
	 * @var string
	 */
	var $email;

	/**
	 * Variable to store error to be output to browser if necessary
	 *
	 * @var string
	 */
	var $error_html;

	/**
	 * Constructor for a_email class
	 *
	 * @param string $email
	 * @return null
	 */
	function a_email($email)
	{
		$this->email = $email;
	}

	function email_is_valid()
	{
		$valid = true;
		if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,8})$", $this->email))
		{
			$valid = false;
			$this->error_html = "$this->email is not properly formatted";
		}
		return $valid;
	}
}
Return current item: a_email