Php if something equals x, y or z
I am writing some kind of php logic and I am 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 have to 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 below example. Thanks to
+3
source to share
2 answers