{"id":373,"date":"2020-08-13T01:09:00","date_gmt":"2020-08-13T05:09:00","guid":{"rendered":"https:\/\/molecularsciences.org\/content\/?p=373"},"modified":"2020-12-24T01:11:04","modified_gmt":"2020-12-24T06:11:04","slug":"php-how-to-validate-email","status":"publish","type":"post","link":"https:\/\/molecularsciences.org\/content\/php-how-to-validate-email\/","title":{"rendered":"PHP: How to validate email"},"content":{"rendered":"\n<p>Validating email is more difficult than one might think. Recently I found this this code at PHP.net and I feel a need to republish this to emphasize its effectiveness and simplicity.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$email = \"user@email.com\";\nif(!filter_var($email, FILTER_VALIDATE_EMAIL)) {\n  echo \"E-mail is not valid\";\n} else {\n  echo \"E-mail is valid\";\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Validating email is more difficult than one might think. Recently I found this this code at PHP.net and I feel a need to republish this to emphasize its effectiveness and simplicity.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23],"tags":[24],"class_list":["post-373","post","type-post","status-publish","format-standard","hentry","category-php","tag-php"],"_links":{"self":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts\/373","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/comments?post=373"}],"version-history":[{"count":1,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts\/373\/revisions"}],"predecessor-version":[{"id":374,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts\/373\/revisions\/374"}],"wp:attachment":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/media?parent=373"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/categories?post=373"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/tags?post=373"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}