is there a way to shorten this if statement condition? PHP -


i making short if there lots of conditions in if statement, there way shorten it?

if(($post->id <= 37) || ($post->id == 42) || ($post->id == 44) || ($post->id == 45) || ($post->id == 46))){     //code here } 

it'll id number different , there's no ranging or old / numbers randoms

is there way make shorter?

if($post->id <= 37 || in_array( $post->id, array( 42,44,45,46))) 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -