vendredi 5 février 2016

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

I am just making this short but if there are lots of conditions in this if statement, is there a way to shorten it?

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

it'll all be id but the number would be different and there's no ranging or old / even numbers just randoms

Is there a way to make it shorter?

Aucun commentaire:

Enregistrer un commentaire