Jeff Atwood (@codinghorror) recently twittered an url to a blogpost from the guys at OpenX.org about their optimization tactics used for their OpenAds framework. All I can say is that the state of PHP at this moment is abysmal. I'll explain why. The writer speaks about three rules they applied when optimizing their code, being: Forget about so-called 'common sense' and trust only a profiler; Use the minimalist approach; Optimize for real life scenarios. I can only agree with these rules, as they should count for...
This is wrong at so many levels:
if($this->mail_protocol == "pop3")
{
$port = "110";
}
else
{
if($mods["imap"]["SSL Support"] == "enabled" && ($this->ssltype == "tls" || $this->ssltype == "ssl"))
{
$port = "993";
}
else
{
$port = "143";
}
}
Whoever can name the most anti-patterns in this small snippet wins a honorable mention in the credits of this post.