$email = "john.doe@example.com"; if (isValidEmailAddr($email)) { echo "The email address is valid."; } else { echo "The email address is not valid."; }
$emails = array("john.doe@example.com", "jane.doe@another.com", "invalid_email"); foreach ($emails as $email) { if (isValidEmailAddr($email)) { echo $email . " is a valid email address."; } else { echo $email . " is not a valid email address."; } }In this example, an array of email addresses is created, and the function is called on each one in a loop. The output displays whether each email address is valid or not. The package library that contains the isValidEmailAddr function is likely to be the PHP built-in function library, as it is a standard function included with PHP.