Or expression doenst work

is possible to use this expression

<?php if($tag==“home || about || contact”):?>

basically i what if tag equals home or about or contact is the way i’m trying valid??

Thank you very much

Not like that :stuck_out_tongue:

See, what you are doing above is asking if tag is equal to the exact string “home || about || contact”.

What you should be doing is asking if tag is equal to the string “home”, the string “about” or the string “contact”.

There are two standard approaches here:

if($tag == "home" || $tag == "about" || $tag == "contact"){

Or, probably prefered:

$accept = array('home', 'about', 'contact');
if(in_array($tag, $accept)){

Or if you’d prefer a shorter (though less readable) version:

if(in_array($tag, array('home', 'about', 'contact'))){