bilis_money Posted October 13, 2007 Share Posted October 13, 2007 can you explain the difference? Quote Link to comment https://forums.phpfreaks.com/topic/73131-define-vs-const/ Share on other sites More sharing options...
pocobueno1388 Posted October 13, 2007 Share Posted October 13, 2007 I'm not sure what you mean by "const", but when you use the function define() you are creating a constant. Only use that if you don't want that value to be changed. www.php.net/define Quote Link to comment https://forums.phpfreaks.com/topic/73131-define-vs-const/#findComment-368777 Share on other sites More sharing options...
marcus Posted October 13, 2007 Share Posted October 13, 2007 Constant is basically predefined. Like, TRUE, FALSE, those are constants, they never change. Stand alone numbers are constant they will never equal anything else. Quote Link to comment https://forums.phpfreaks.com/topic/73131-define-vs-const/#findComment-368778 Share on other sites More sharing options...
trq Posted October 13, 2007 Share Posted October 13, 2007 They both do that same thing in different context. You use the define function to define a constant in your scripts, you use the const keyword to declare a variable as the type constant only within classes (php5). Quote Link to comment https://forums.phpfreaks.com/topic/73131-define-vs-const/#findComment-368849 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.