User query in PHP does not work I would like to get user query in my custom PHP plugin.

According to this document, the code would be like this.
https://docs.craftcms.com/v3/dev/element-queries/user-queries.html#example

$queryAllUsers_email = User::find()-&gt;email($new_email);
if (count($queryAllUsers_email) &gt; 0) {
    // ...
}


User means Craft\Elements\User class.

However, the count is 0.

It would be grateful for me if you tell me what is wrong.
Try this:

$queryAllUsers_email = User::find()
    -&gt;email($new_email)
    -&gt;anyStatus()
    -&gt;all();


It's likely the email address you're searching for is for a user that isn't activated yet or suspended, etc.

Using anyStatus will search for the user regardless of their status.