y2yang Posted May 9, 2009 Share Posted May 9, 2009 I would like to perform two condition in one else if statement. Here is my code: <?php } // end if elseif($Article == "1" && $numrows == 0){ ?> Don't know if this is right, but certainly it's not showing what I wanted. BTW, what is &, &&, % used mainly for in php? ...and by any chance would someone explain what this code do for me? Thanks. Been having it for a while but still don't know how it works; I don't feel so proud of myself ??? <?php if (!empty($count) && $count % $half_point == 0) { ?> Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 9, 2009 Share Posted May 9, 2009 I don't know if the first code snippet is right either. What's considered right? It should run without errors. & = a bitwise AND operator (you probably shouldn't worry about this one) && = AND operator % = modulo (which means remainder after division) The second code snippet says "if $count is not empty and the remainder of count divided by half_point is 0, then..." 5 % 2 = 1 because 5/2 = 2 with a remainder of 1. Quote Link to comment Share on other sites More sharing options...
juma929 Posted May 9, 2009 Share Posted May 9, 2009 Hey, Can I see the rest of your script so I can see where things may be going wrong before the IF condition, for example you may need to use === instead of == depending on the situation. Either way I will probably have to see more to see how the $Article and $numrows variables are being set. Thanks, Justin Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.