We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Confusion with the calculation result of the query

Why is this code for a successful query and query where there is no result

user_id = 1; // or 5000 $user = Users::findFirst("id = '$user_id'"); count($user);

always outputs 1

Why if the user does not count it zero?



2.9k

Users::findFirst will return Users object or false.

var_dump(count(false)) => int 1