lawls
lawls

Reputation: 1508

PHP function_exists() returns false for empty()

Why does function_exists("empty")return false?

if (function_exists("empty")) {
    echo "Not working";
}

Documentation states the following for function_exists:

Checks the list of defined functions, both built-in (internal) and user-defined, for function_name.

As far as I know empty is a defined and built-in function.

Upvotes: 0

Views: 594

Answers (1)

phuk
phuk

Reputation: 1118

Empty is not a function. According to manual:

Note: Because this is a language construct and not a function, it cannot be called using variable functions.

https://www.php.net/manual/en/function.empty.php

Upvotes: 5

Related Questions