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) Link to comment https://forums.phpfreaks.com/topic/79448-solved-fast-noobish-question/ 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))) ?> Link to comment https://forums.phpfreaks.com/topic/79448-solved-fast-noobish-question/#findComment-402273 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 ! Link to comment https://forums.phpfreaks.com/topic/79448-solved-fast-noobish-question/#findComment-402277 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.