Use of || (or)
I got so many values which I need to compare with same variable, is there a better way to write more efficiently such as $city == -35 || -34 || -33 or even simpler so that I don’t have to repeat variable name since it’s the same variable only value keep changing.
<?php
if ($city == -35 || $city == -34 || $xcity == -33)
{
$region = "noindex";
}
?>
Any suggestions?
You might use
in_array()Or if they are consecutive ( I suspec they aren’t and this is just an example)