How can the code be modified to ensure that only one email is outputted instead of two?

The issue is that the code is outputting the email twice because the loop is iterating over the array of emails and echoing each one. To ensure only one email is outputted, we can simply remove the loop and directly access the first element of the array.

<?php
$emails = array("john.doe@example.com", "jane.smith@example.com");
echo $emails[0];
?>