I have several strings which may or may not be empty. If any of them are non-empty, a mysql insertion should be called.
I've coded it simply, but was thinking about the fastest method of testing if ANY of them is non-empty.
$a = something;
$b = something;
$c = something;
Options
I would do something like this:
if (!$a || !$b || !$c){
...
}
There is no overhead of a function like strlen
etc. The !
is good bet there.
Wouldn't one way of finding out be testing by generating, let's say, at set of 1000 random strings and traverse that set for each option? I assume it's quite a naive way and reading about the native code for each function would generate a more thorough answer, but still, it's easy :)