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 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) ? 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 :) Link to comment https://forums.phpfreaks.com/topic/11779-ifvar1or2or3/#findComment-44590 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.