[nycphp-talk] Any ideas appreciated... short cuts are not always a good thing for script maintenance... need some advise...
mikesz at qualityadvantages.com
mikesz at qualityadvantages.com
Fri Oct 19 22:47:34 EDT 2007
Greetings and Hello,
I am converting a script to use SMTP if php mail() is not available
for the users of this script. I have all the active calls working so
that if my smtp flag is set it automatically switches to smtp and
sends the message with the appropriate headers etc. but part of the script is run by a
cron job and I see a php mail call but don't quite understand the syntax.
Anyone care to take a guess at translating what it does?
It is part of a while loop and I think its combining two conditions
into one statement but would like confirmation.
here is the code fragment:
if ( !mail( $row['Email'], $row[Subj], $row[Body], "From: $site[email_notify]", "-f$site[email_notify]") )
++$err;
I thinks this is the equivalent of:
if ( !mail( $row['Email'], $row[Subj], $row[Body], "From: $site[email_notify]", "-f$site[email_notify]") )
{
++$err; //update the error queue
}
else
{
mail( $row['Email'], $row[Subj], $row[Body], "From: $site[email_notify]", "-f$site[email_notify]");
}
Has anyone seen or used this technique before? This is the first time
I have seen it used, though this script has a lot of short cuts that
make the code difficult to debug sometimes, like this one.
Thanks in advance for your comments,
--
Best regards,
mikesz mailto:mikesz at qualityadvantages.com
More information about the talk
mailing list