johnsmith153 Posted June 24, 2010 Share Posted June 24, 2010 define('HELLO', 'how are you?'); $hello = "how are you"; echo HELLO; echo $hello define or $ variable, which is better and why would you have both? Quote Link to comment https://forums.phpfreaks.com/topic/205735-define-vs-variable/ Share on other sites More sharing options...
Adam Posted June 24, 2010 Share Posted June 24, 2010 A define AKA a "constant", has a constant value; once defined it cannot be changed. Variables are also only available within the same scope, constants are global. Quote Link to comment https://forums.phpfreaks.com/topic/205735-define-vs-variable/#findComment-1076568 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.