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

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -