Chief Alchemist - Business Consulting For The 21st Century Via A Holistic & Intelligent Approach
Share ChiefAlchemist.com. RSS 2.0 feed for ChiefAlchemist.com. Sign up for the mailing list. Follow Chief Alchemist on Twitter. 'Like' the Chief Alchemist's page on Facebook. See what Chief Alchemist has been Q&A'ing on Quora. Chief Alchemist bookmarks & highlights on Diigo.com. Follow the Chief Alchemist on Digg.com. Chief Alchemist channel on Last.fm. Chief Alchemist on Flickr. Mark 'Chief Alchemist' Simchock on LinkedIn. Free Initial Consultation. Email Chief Alchemist. Phone Chief Alchemist.
  • Mark ‘Chief Alchemist’ Simchock
  • 'Email me.Email => ca .at. ChiefAlchemist .dot. com
  • 'Phone me.Alchemy United => 732 997-0028
  •  
  • Free initial consultation.Free => Initial Consultation
  • Please be sure to subscribe to your communication channels of choice.
  • Click To Close => The small green (consultation), red (email) or blue (phone) icons in the top upper right.
CURRENT “TOP 10” TOPICS TOOLS CLIENTS & PROJECTS SOURCES SEARCH HIDE
Business Consulting For The 21st Century Via A Holistic & Intelligent Approach

Simple PHP email validation function

FYI => I don’t profess to be a PHP guru so I could be slightly off target on this one. But best I can tell there isn’t a native function in plain vanilla PHP (note: as opposed to a framework) that take a sting input and returns a simple TRUE or FALSE on whether that string is a valid email or not.

I was tweaking and enhancing AU_WPing this past weekend and needed such a function, so I whipped it up. After I mentioned it a couple days ago a colleague asked me about it. So here it is…
// Returns whether an email is valid (TRUE) or not (FALSE)
if (!function_exists("funct_EmailValidateBool")) {
function funct_EmailValidateBool($str_Email) {
if (filter_var($str_Email, FILTER_VALIDATE_EMAIL) == FALSE) {
return FALSE;
} else {
return TRUE;
} // close if
} // close function
} // close function_exist

I have another function that I’ll share some other time that takes a delimited string of email addresses and returns a delimited string with only valid emails. In other words, the invalid emails are removed. I’ll share that once I’m sure it’s working. I added a couple tweaks to the basics just described.

btw, I code because sometimes developing a business solutions requires it.

Required.
Will not be published. Required.
Please include http://