npsari Posted June 8, 2007 Share Posted June 8, 2007 Hi I want the below (if function) to meet two conditions, so i separtared them with commas ($Start2>35, $Display>4) if ($Start2>35, $Display>4) { print"<font style=\"font-size:13px\" color=\"#000000\" face=\"Arial\"><b>1</b></font>"; }else{ print"<font style=\"font-size:13px\" color=\"#000000\" face=\"Arial\"><b>2</b></font>"; } or should i say ($Start2>35 AND $Display>4) Link to comment https://forums.phpfreaks.com/topic/54757-sometimes-the-simplest-questions-in-life-can-be-a-trouble/ Share on other sites More sharing options...
unidox Posted June 8, 2007 Share Posted June 8, 2007 You need spaces if ($Start2 > 35, $Display > 4) { print"<font style=\"font-size:13px\" color=\"#000000\" face=\"Arial\"><b>1</b></font>"; }else{ print"<font style=\"font-size:13px\" color=\"#000000\" face=\"Arial\"><b>2</b></font>"; } Link to comment https://forums.phpfreaks.com/topic/54757-sometimes-the-simplest-questions-in-life-can-be-a-trouble/#findComment-270789 Share on other sites More sharing options...
npsari Posted June 8, 2007 Author Share Posted June 8, 2007 ohh, lol thats a joke right, cus from what i recall spaces aint critical Link to comment https://forums.phpfreaks.com/topic/54757-sometimes-the-simplest-questions-in-life-can-be-a-trouble/#findComment-270792 Share on other sites More sharing options...
per1os Posted June 8, 2007 Share Posted June 8, 2007 if ($Start2>35 && $Display>4) { OR if ($Start2>35 AND $Display>4) { Whichever you want to do. Link to comment https://forums.phpfreaks.com/topic/54757-sometimes-the-simplest-questions-in-life-can-be-a-trouble/#findComment-270793 Share on other sites More sharing options...
per1os Posted June 8, 2007 Share Posted June 8, 2007 ohh, lol thats a joke right, cus from what i recall spaces aint critical Spaces do not matter at all. You need the proper operator/syntax which is && or AND. Link to comment https://forums.phpfreaks.com/topic/54757-sometimes-the-simplest-questions-in-life-can-be-a-trouble/#findComment-270795 Share on other sites More sharing options...
npsari Posted June 8, 2007 Author Share Posted June 8, 2007 Thanks guys, fixed that bug What if i have this messed up condition... if (!isset($Start) || empty($Start)) { Can i say if (!isset($Start) || empty($Start)) AND $Start2>35 AND $Display>4 { Link to comment https://forums.phpfreaks.com/topic/54757-sometimes-the-simplest-questions-in-life-can-be-a-trouble/#findComment-270798 Share on other sites More sharing options...
per1os Posted June 8, 2007 Share Posted June 8, 2007 if ((!isset($Start) || empty($Start)) && ($Start2>35 && $Display>4)) { Parans signify order of operations, just like basic algebra. And I would also be consistent if you are using || instead of OR use && instead of AND and vice versa. Link to comment https://forums.phpfreaks.com/topic/54757-sometimes-the-simplest-questions-in-life-can-be-a-trouble/#findComment-270808 Share on other sites More sharing options...
npsari Posted June 8, 2007 Author Share Posted June 8, 2007 I see what u mean, ok, now i got it It is just like math thanks Link to comment https://forums.phpfreaks.com/topic/54757-sometimes-the-simplest-questions-in-life-can-be-a-trouble/#findComment-270810 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.