vendredi 26 décembre 2014

php if something equals x, y or z

I am writing out some php logic, and I'm trying to simplify something.


Is it possible to write something like the following:



<?php if( (get_theme_mod('header_image_location')=='x', 'y' or 'z' ) {?>
//Do something
<?php } ?>


I must I do it like this:



<?php if( (get_theme_mod('header_image_location')=='x') || (get_theme_mod('header_image_location')=='y') || (get_theme_mod('header_image_location')=='z') ) {?>
//Do something
<?php } ?>


Just want to know if I can simplify the bottom example. Thanks


Aucun commentaire:

Enregistrer un commentaire