eldan88 Posted May 5, 2014 Share Posted May 5, 2014 Hey guys. When ever a consant is set to an empty string its still shows as it being defined. I have an application that sets some constans based on a form submession. However some optional forms fields has not been filed out and it sets the constants to "". i.e define("NAME", ""); Is there any PHP function I can use to tell PHP to preform a set of conditions if the constant is "". I have tried googling it but couldn't get anything. From what I know isset and empty won't work with constants. Does anyone might have an alternative? Thanks Quote Link to comment Share on other sites More sharing options...
ginerjm Posted May 5, 2014 Share Posted May 5, 2014 So why not just check for ''? Quote Link to comment Share on other sites More sharing options...
Solution eldan88 Posted May 5, 2014 Author Solution Share Posted May 5, 2014 Hey thanks for the reply. I just checked if you can see if constant is empty by checking it is equal to NULL. Quote Link to comment Share on other sites More sharing options...
trq Posted May 5, 2014 Share Posted May 5, 2014 The idea of constants being defined via form submission sounds all together dodgy. They are "constant" for a reason. They are meant to be reliable. Why are you using constants for this data? Quote Link to comment Share on other sites More sharing options...
eldan88 Posted May 5, 2014 Author Share Posted May 5, 2014 Its a long story and it was done 2 years ago. But its to save the settings of a store configuration file... It works fine.. I wouldn't want to change something that works.. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.