So... This is more of a curiosity, not a real problem. I don\'t get this:
Results in: Pars
empty
is a reserved keyword in PHP. You cannot use any reserved words as constants, class names, function or method names as these words have special meaning in PHP. Use any other name as constant.
Note that the reserved keywords are also case insensitive, and they can't be defined as constant or redefined using runkit_function_redefine();
You can find here the exhaustive list of reserved keywords
empty
is not a function but a language construct (more like an operator than a function), which means it's resolved by the parser at parse time and not by the runtime. It's a reserved keyword and you cannot use it for anything yourself like function names, or constants.
The reason empty
cannot be a regular function is because it behaves differently. empty($undefined)
would first resolve $undefined
, throw an error, then pass null
to empty
; which is exactly the case empty
is supposed to prevent, so it cannot play by the normal function invocation rules.
You can definately define "EMPTY" as a constant. The problem is you can't use it directly.
<?php
define("EMPTY", "valueForEmpty");
echo EMPTY; // Wont work because empty is a keyword and PHP doesn't know that you mean the constant.
echo constant("EMPTY"); // Works