neddy Posted June 12, 2006 Share Posted June 12, 2006 heyive been using php for a while now but never needed this before (or even know if its possible)so heres what i have..[code]if($var = 1) {print $var." = 1";}else{print $var." doesnt = 1"}[/code]i need to change it to[code]if($var = 1 or 2 or 3) {....[/code]how do i go about doing that? i tried a few ways but couldnt figure it out, and couldnt find anything more complex then what i already have on any online tutorials...cheers Quote Link to comment https://forums.phpfreaks.com/topic/11779-ifvar1or2or3/ Share on other sites More sharing options...
joquius Posted June 12, 2006 Share Posted June 12, 2006 if (1 <= $var <= 3) ? Quote Link to comment https://forums.phpfreaks.com/topic/11779-ifvar1or2or3/#findComment-44587 Share on other sites More sharing options...
neddy Posted June 12, 2006 Author Share Posted June 12, 2006 dohas soon as i posted i found the answermy 1,2,3 are gonna be different numbers soi need oranyway i did[code]if($var == 1 || $var == 2 || $var == 3) {[/code]seems to be workingthanks anyway :) Quote Link to comment https://forums.phpfreaks.com/topic/11779-ifvar1or2or3/#findComment-44590 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.