...

View Full Version : Advanced If



nobackseat88
10-18-2009, 04:31 PM
How could I correctly format this?


if($num > 10 || $num == 10 && $num < 20 || $num == 20) {

}


I intend for at least one on each side of the && symbol to prove true.

Thanks!

abduraooft
10-18-2009, 04:52 PM
Group them like

if(($num > 10 || $num == 10 )&& ($num < 20 || $num == 20)) {

} to override the priority of && over ||

Or simply
if($num >= 10 && $num <= 20 ) {

}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum