This question was asked in a recent job interview I gave and I was unable to answer it. Here is the question:
From a given email list (johndoe@noemail.com, xyz@no-email.com, noemail@xyz.com, answers@no email.com, jpt@nooooemail.com, kondoe@nomail.com) extract only those emails ending with (@noemail.com, @no-email.com, and @no email.com).
I searched and tried to run the code but it didn't ran.
<?php
$email_list = (johndoe@noemail.com, xyz@no-email.com, noemail@xyz.com, answers@no email.com, jpt@nooooemail.com, kondoe@nomail.com);
$pattern = ('@noemail.com', '@no-email.com', '@no email.com' );
echo preg_match($pattern, $email_list);
?>