Parse error: syntax error, unexpected T_FUNCTION, expecting T_STRING

Parse error: syntax error, unexpected T_FUNCTION, expecting T_STRING in /var/www/include/functions.php on line 2

I get this error when I run this file.

class Function
{
	function email_check($email){
		if(preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/", $email)){
			list($email)=split('@',$email);
			if(!checkdnsrr($email,'MX')) {
				return false;
			}
			return true;
		}
		return false;
	}
};

$function = new Function;

Anyone know why i am getting this error??

Hi there,

I believe it may be due to you using a reserved keyword as your class name. Try changing it to “class MyFunction”

Sponsor our Newsletter | Privacy Policy | Terms of Service