Monkuar Posted July 5, 2009 Share Posted July 5, 2009 if ($member['id'] == 1) { $this->output = preg_replace( "/<!--interests-->/e", "\$this->html->interests(\$info)", $this->output ); } I want to beable to put more then just 1 right there Member id 1 and 2 should see the output too! So how would i do like this?? if ($member['id'] == 1,2) or ? if ($member['id'] == 1|2) ??Thx Quote Link to comment Share on other sites More sharing options...
haku Posted July 5, 2009 Share Posted July 5, 2009 if ($member['id'] == 1 || $member['id'] == 2) { // do some stuff } Quote Link to comment Share on other sites More sharing options...
Monkuar Posted July 5, 2009 Author Share Posted July 5, 2009 thx sir!!! Quote Link to comment Share on other sites More sharing options...
.josh Posted July 5, 2009 Share Posted July 5, 2009 if you plan on making that list of numbers grow, it would be better for you to do this: $memberIds = array('1','2'); if(in_array($member['id'],$memberIds)) { // stuff here } That way you can just add to the array the single id instead of having to have this really long condition. And you can dynamically populate the array. Can't dynamically populate the condition unless you get into using eval() (which you don't want to do). Quote Link to comment Share on other sites More sharing options...
Monkuar Posted July 6, 2009 Author Share Posted July 6, 2009 if you plan on making that list of numbers grow, it would be better for you to do this: $memberIds = array('1','2'); if(in_array($member['id'],$memberIds)) { // stuff here } That way you can just add to the array the single id instead of having to have this really long condition. And you can dynamically populate the array. Can't dynamically populate the condition unless you get into using eval() (which you don't want to do). Wow thanks abunch u guys are smart!! 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.