PHP Strangeness
Okay, so I’m using PHP Version 4.3.8 and I’m happily coding along until I get to this:
$PICS_IMG = 0;
// Special icon
if ($forum_id == 14)
$PICS_IMG = ( $unread_topics ) ? "http://www.googlecommunity.com/f/14n.gif" : "http://www.googlecommunity.com/f/14.gif";
// Default icon
if ($PICS_IMG == 0)
$PICS_IMG = ( $unread_topics ) ? "http://www.googlecommunity.com/f/1n.gif" : "http://www.googlecommunity.com/f/1.gif";
What do you expect to happen if $forum_id is 14? I would expect either 14n.gif or 14.gif, because once that is set, $PICS_IMG will not be 0.
But no! That’s not the case!
The expected behavior (to me) only occurs if I use if ($PICS_IMG === 0) — that is, I add an extra = sign. More info at PHP language comparison operators.
Is your coding the reason why the Cybiko forums are down?
if ($forum_id == 14)
{ // Bracket.
$PICS_IMG = ( $unread_topics ) ? “http://www.googlecommunity.com/f/14n.gif” : “http://www.googlecommunity.com/f/14.gif”;
} // Another one.
i tried it for my forums http://www.talklifeforums.com and its not working :(