What is the purpose of storing email addresses in an array in PHP?

Storing email addresses in an array in PHP can be useful for various purposes such as sending bulk emails, managing a list of subscribers, or validating email addresses. By storing email addresses in an array, you can easily iterate through the list, perform operations on each email address, or retrieve specific email addresses based on certain criteria.

// Storing email addresses in an array
$emailAddresses = [
    'john.doe@example.com',
    'jane.smith@example.com',
    'alice.wonderland@example.com'
];

// Iterating through the array of email addresses
foreach ($emailAddresses as $email) {
    echo $email . "\n";
}

// Retrieving a specific email address from the array
$specificEmail = $emailAddresses[0];
echo "Specific email address: " . $specificEmail;