How can PHP be used to send emails based on specific data from a 2-dimensional array?
To send emails based on specific data from a 2-dimensional array in PHP, you can loop through the array, check for the specific criteria, and then send an email using a function like PHPMailer or the built-in mail() function. You can use conditional statements within the loop to determine when to send an email based on the data in the array.
// Assuming $data is a 2-dimensional array with email data
foreach ($data as $row) {
if ($row['criteria'] == 'specific_value') {
$to = $row['email'];
$subject = 'Subject of the email';
$message = 'Content of the email';
// Send the email using PHPMailer or mail() function
// Example using mail() function
mail($to, $subject, $message);
}
}