Re: Variable vs Constant

From: Date: Tue, 28 May 2002 08:38:16 +0000
Subject: Re: Variable vs Constant
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-99452@lists.php.net to get a copy of this message
Thx Hugh i got what u mean....let me give u more background for my problem i am now working on a project which was developed by some others b4. As the project is a multi-language enabled, there is a PHP file (language file) which has all the setting , say -------------------------------------------- $i_no_record_exists_msg = "There is no record at the moment."; $i_no_search_result_msg = "Sorry, your search yielded no results. Please revise your search query and try again."; $i_alert_pleasefillin = "Please fill in the "; $i_email_to = "To"; $i_status_approve = "Approve"; $i_status_pendinguser = "Pending"; $i_status_publish = "Publish"; $i_status_checkin = "Check In"; ..... .. .. -------------------------------------------- In this language file, over 500 variables are declared. And what i scare is 1. programmatically, should i change all these to CONSTANT? (coz all these values will never change) 2. if there is difference in declaring variable and constant (say, memory space required), how much harm it will ? 3. as this file would be included in the entire system....the downside will be even more.... thx Billy "Hugh Danaher" <hdanaher@earthlink.net> wrote in message news:000701c20620$885cd2e0$0100007f@localhost... > Billy, > There must be a limit to the number of variables you can use in php but I > haven't run up against a limit yet, and php seems to run as fast on my high > variable count code as my more mundane code. > Obviously, the advantage of using variables is that you can group your > "variables/constants" in one area at the top of your code and when you need > to change one of the constants (and you know you will need to do this > eventually) you won't need to look for it in amongst your code. > Not really an answer to your question but more of an observation on my part. > I hope one of the more experienced will also pipe in. > Good Luck > Hugh > ----- Original Message ----- > From: "Billy" <hpsquare@yahoo.com> > To: <php-general@lists.php.net> > Sent: Monday, May 27, 2002 8:46 AM > Subject: [PHP] Variable vs Constant > > > > what harm will it make if i declear a value as VARIABLE where i should > make > > it as CONSTANT actually?? > > > > how about if i declear 100 values as VARIABLEs where all are CONSTANTs > > actually? > > > > thx > > HPS > > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > >

« previous php.general (#99452) next »