RSS | Archive | Random | E-mail

About

Hi, I'm Christian Castelli, a 28 years old italian programmer located in Pisa (Italy). Here I post small snippets of code which can be useful in my work.

Links

Codepuzzling main site
Development site
ByteStrike italian blog
Follow me on Twitter

My Life Style

while(passion) {
  try {
    myLife.run();
  }catch(LifeExceptions) {  
    stronger++;
    continue;
   }
}

Following

7 January 10

[PHP] Email validation considering PHP version

function isValidEmail($email)
{
	if(version_compare(PHP_VERSION, '5.2.0', '>=')
		return filter_var($email, FILTER_VALIDATE_EMAIL);
	else
		return eregi('^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$', $email);
}

Comments (View)
blog comments powered by Disqus
Themed by Hunson. Originally by Josh