How can you check if a specific email address is present in an array of email addresses in PHP?

To check if a specific email address is present in an array of email addresses in PHP, you can use the in_array() function. This function checks if a value exists in an array and returns true if the value is found, and false otherwise.

<?php
$email = 'example@email.com';
$emailArray = ['test1@email.com', 'test2@email.com', 'example@email.com', 'test3@email.com'];

if (in_array($email, $emailArray)) {
    echo "Email address is present in the array.";
} else {
    echo "Email address is not present in the array.";
}
?>