i have the following piece of code in php:
define('QUERY', $some_query_string);
if(empty(QUERY) || mb_strlen(QUERY) < 4):
//worn the user about incorrect query input
endif;
when running this script i’m getting the fallowing error Parse error: syntax error, unexpected ')', expecting T_PAAMAYIM_NEKUDOTAYIM, but when i’m using an ordinary variable instead of constant everything works just fine!
The usage of constant is not required, but i would appreciate if anyone could explain why i’m getting that error?
(i’m newby here, so please tell me if i have to provide more details)
emptyonly works with variables. If you want to check whether a constant has been defined, usedefined. The error messages invalid uses ofemptyproduce aren’t necessarily very intuitive, the message about T_PAAMAYIM_NEKUDOTAYIM mostly means the parser tripped up.