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
- if($a!="" || $b!="" || $c!="")
- if($a.$b.$c!="")
- if(strlen($a) || strlen($b) || strlen($c))
- if(strlen($a)>0 || strlen($b)>0 || strlen($c)>0)
- if(strlen($a.$b.$c))
- if(strlen($a.$b.$c)>0)
i this:
if (!$a || !$b || !$c){ ... }
there no overhead of function strlen
etc. !
bet there.
Comments
Post a Comment