asmith Posted November 29, 2007 Share Posted November 29, 2007 if (($a != 3) && ($a != 7) && ($a != 10) && ($a != 16) ) can this code be written shorter than this ? (i don't know what keyword to search ! sorry) Quote Link to comment Share on other sites More sharing options...
thebadbad Posted November 29, 2007 Share Posted November 29, 2007 <?php $array = array(3, 7, 10, 16); if (!in_array($a, $array)) ?> or even shorter <?php if (!in_array($a, array(3, 7, 10, 16))) ?> Quote Link to comment Share on other sites More sharing options...
asmith Posted November 29, 2007 Author Share Posted November 29, 2007 gotcha ! thanks sometimes i think i forgot everything. lol a simple array ! 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.