[Vtigercrm-developers] A question on efficiency/semantics...
Alan Lord
alanslists at gmail.com
Wed May 5 14:14:40 GMT 2021
In the fairly recent past there have been a number of minor commits made
which, I guess, are to help prevent php WARNING and/or NOTICE type
messages, e.g.
Something like this:
> if (count($variableList) > 0) {
became this:
> if (!empty($variableList) && (count($variableList) > 0)) {
But this seem to be overkill...
As I understand things simply doing this:
>if ($variableList) {
would provide the same result? To me that simple if($var) statement
says, "if $var is not equal to a boolean false, or 0, or null then
continue"...
count($var) would return an integer if $var is a string, so it is not a
useful explicit test for an array.
And from the php manual, empty($var) says "a variable is considered
empty if it does not exist or if its value equals false"
Thoughts / Comments?
Al
More information about the vtigercrm-developers
mailing list