See the note here:
Prior to PHP 5.5, empty() only supports variables; anything else will result in a parse error. In other words, the following will not work: empty(trim($name)). Instead, use trim($name) == false.
So you should rather compare against null
as constant()
will return null
for undefined constants, or use defined()
instead.
if(constant('MY_CONST')!==null) { ... }
if(!defined('MY_CONST')) { ... }