M.O.S. Studios Posted April 30, 2009 Share Posted April 30, 2009 Hey guys, I'm working on a library to use in my applications. However I have the need to redefine certain constants, any one know how? Quote Link to comment Share on other sites More sharing options...
Mchl Posted April 30, 2009 Share Posted April 30, 2009 As the name suggests, that value cannot change during the execution of the script (except for magic constants, which aren't actually constants) They wouldn't be called constants if you could do that. Quote Link to comment Share on other sites More sharing options...
M.O.S. Studios Posted April 30, 2009 Author Share Posted April 30, 2009 well i guess i figured that out by the name, but i was hopping. i import my defines first, then depending what the application was used for i wanted to pull in a bunch of "redefines"; but oh well.... any way to suggest that to the php gods? Quote Link to comment Share on other sites More sharing options...
.josh Posted April 30, 2009 Share Posted April 30, 2009 constants you can redefine are called variables. Quote Link to comment Share on other sites More sharing options...
M.O.S. Studios Posted April 30, 2009 Author Share Posted April 30, 2009 granted fair point Quote Link to comment Share on other sites More sharing options...
Mchl Posted April 30, 2009 Share Posted April 30, 2009 Any way to redeclare Pi, e, Planck's constant? I don't think so. The purpose of constant is to retain their value throughout the execution of the program. This is how they work in all programming languages (that support constants). You should probably either use variables, or defer definition of constants until you know the values they should be assigned. Quote Link to comment Share on other sites More sharing options...
M.O.S. Studios Posted May 6, 2009 Author Share Posted May 6, 2009 well i use a wrapper that does all the defines before the app is executed. what i ended up doing is defined the custom constants before the standard ones i use by loading them first. thanks for the help 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.