I have a script that gets ran periodically and I was just curious which way I should code it to maximize speed…
is it quicker to check if a variable’s value exists and skip setting it, or simply just set the value again?
e.g., is it faster to:
if($variable=="") { $variable = "blah"; }
OR just have
$variable = "blah";
OR is this a non-issue? will the speed differences at the end of the day be negligible?
thanks for your help…
I think the speed difference is negligible, but the logic of your two examples is fundamentally different (setting a value unconditionally, versus setting a value only if the current value is empty).