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
Post a Comment