Why does count() return 0 here?
I have the following code :
开发者_如何学Pythonecho $gibs=Db::getResult($sql,$query);
print_r($gibs);
count($gibs);
if($gibid!='' && count($gibs)<=0){
$gibs=array(
'gibid'=>$gibid,
'userid'=>$userid,
'isowner'=>false
);
}
Resulting output :
ArrayArray ( )
why count($gibs)
not returning any thing.
thats why the flow don't going in if condition.
To see the output of count($gibs);
you should assign the function to some variable, or print it:
print_r(count($gibs));
In your case, it's value will be 0
, because $gibs
array is empty (it is seen out of the print_r
output).
If
condition might not work, because $gibid == 0
精彩评论