I have an array of values I want to run php’s built-in email validation filter on. How do I run the filter against each array item, keeping the items that pass in the array?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Use php’s
array_filter: http://php.net/manual/en/function.array-filter.phpExample (Updated to use FILTER_VALIDATE_EMAIL):
Now, $email_addresses will only contain me@example.com