Optimal way of checking if any of multiple strings are non-empty (in php) -


i have several strings may or may not empty. if of them non-empty, mysql insertion should called.

i've coded simply, thinking fastest method of testing if any of them non-empty.

$a = something; $b = something; $c = something; 

options

  1. if($a!="" || $b!="" || $c!="")
  2. if($a.$b.$c!="")
  3. if(strlen($a) || strlen($b) || strlen($c))
  4. if(strlen($a)>0 || strlen($b)>0 || strlen($c)>0)
  5. if(strlen($a.$b.$c))
  6. if(strlen($a.$b.$c)>0)

i this:

if (!$a || !$b || !$c){    ... } 

there no overhead of function strlen etc. ! bet there.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -