Jay2391 Posted February 1, 2007 Share Posted February 1, 2007 I am trying to diplay a message base on data from a range so I want something like if the code below... if($activity == 1 or 2 or 3 or 4 or 5 or 6 ){ $activity1 = "New Member"; } is there a way to do like the random function like from 1 to 6 I try this but is incorrect... if($activity == (1, 6)){ $activity1 = "New Member"; } I am looking for the correct way ...to do that Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 1, 2007 Share Posted February 1, 2007 $num = rand(1,6) Quote Link to comment Share on other sites More sharing options...
alpine Posted February 1, 2007 Share Posted February 1, 2007 <?php if(in_array($activity, range(1,6))){ $activity1 = "New Member"; } ?> Quote Link to comment Share on other sites More sharing options...
Psycho Posted February 1, 2007 Share Posted February 1, 2007 Another option if ($activity>=1 && $activity<=6) { $activity1 = "New Member"; } Quote Link to comment Share on other sites More sharing options...
Jay2391 Posted February 1, 2007 Author Share Posted February 1, 2007 this is what i need it ... thnaks <?php if(in_array($activity, range(1,6))){ $activity1 = "New Member"; } ?> 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.