PHP: empty - Manual[
^] determines if a
variable is considered to be empty but
BASE_PATH
is a named constant.
To check if a named constant is defined use
PHP: defined - Manual[
^].
But a named constant might be defined and empty. So you would have to assign the constant to a variable:
if (defined('BASE_PATH')) {
$base = BASE_PATH;
if (empty($temp)) {
$base = __DIR__;
}
}
Overall it would be probably better to use a variable initially instead of a named constant.