Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Optimising and consolidating multiple PHPMailer functions Reply To: Optimising and consolidating multiple PHPMailer functions

#167749
__
Participant

Compose the message elsewhere, and make the function responsible only for preparing and sending the email.

Also, don’t do this!

function whatever( $arg1,$arg2 ){
    global $var1;
    //  ...
}

do this instead:

function whatever( $arg1,$arg2,$var1 ){
    //  ...
}

global state is evil.