OR function in if (trim() == "") {}in PHP -
or function in if (trim() == "") {}
in php?
tried this, not work:
if (trim($query) == "a" or "b") {$search= 'd'; }
i want if either or b exist d goes $search
learn php right way php manual. should be:
if (trim($query) == "a" || trim($query) == "b") { $search= 'd'; }
or can use in_array
:
if (in_array(trim($query), array('a', 'b'))) { $search = 'd'; }
if wanna partial ones, can do:
if (strpos("a", trim($query)) > -1 || strpos("b", trim($query)) > -1) {
Comments
Post a Comment