Is this an array of redundant code: $ list
If ($ list & count ($ list)> 0 ){
Echo 'not blank ';
} Else {
Echo 'Empty ';
}
Code: count ($ list)> 0 is unnecessary?
Reply to discussion (solution)
If you select between $ list and count ($ list)> 0, it is unnecessary. the purpose of repeated judgment is to prevent multiple situations!
If you select between $ list and count ($ list)> 0, it is unnecessary. the purpose of repeated judgment is to prevent multiple situations!
Let me give an example of what happened.
In many cases, subsequent code or previous code needs to be combined with context.
This is basically redundant. If it is an array, $ list and count ($ list)> 0 are basically equivalent.
Note that:
Although the count function is designed to calculate the number of elements in an array, you can also pass a string as a parameter:
$ Str = ""; // empty string
Var_dump ($ str); // string (0 )""
Var_dump (count ($ str); // int (1)
Of course, this has nothing to do with this question... Can be ignored