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 Link to comment https://forums.phpfreaks.com/topic/36659-from-one-to-another/ Share on other sites More sharing options...
Jessica Posted February 1, 2007 Share Posted February 1, 2007 $num = rand(1,6) Link to comment https://forums.phpfreaks.com/topic/36659-from-one-to-another/#findComment-174750 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"; } ?> Link to comment https://forums.phpfreaks.com/topic/36659-from-one-to-another/#findComment-174753 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"; } Link to comment https://forums.phpfreaks.com/topic/36659-from-one-to-another/#findComment-174755 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"; } ?> Link to comment https://forums.phpfreaks.com/topic/36659-from-one-to-another/#findComment-174760 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.