Option 1 or Option 2 which is the most feasible way in terms of memory and performance usage to append multiple email ids in the following loop.
Option 1: String $errorString
while (!feof($file_handle)) {
$errorString .= $email."<br>";
}
Option 2: Array $errorArray[]
while (!feof($file_handle)) {
$errorArray[].= $email."<br>";
}
The array will use a little more memory, because it needs to store all the strings and all the array elements that refer to them.
The string will take more time, because every time you concatenate it has to copy the both strings into the new value of $errorString.
Unless you have thousands of emails it's unlikely to make any noticeable difference, so you should use whichever method makes the rest of the code easier. Premature optimization is the root of all evil.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With