[PHP] Variable vs Constant

2002-05-28 Thread HPS

what harm (in term of loading/performance) 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




Re: [PHP] Variable vs Constant

2002-05-28 Thread hugh danaher

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 [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
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



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Variable vs Constant

2002-05-28 Thread HPS

Thx Hugh

i got what u meanlet 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 systemthe downside will
be even more

thx
Billy


Hugh Danaher [EMAIL PROTECTED] wrote in message
000701c20620$885cd2e0$017f@localhost">news:000701c20620$885cd2e0$017f@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 [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 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
 




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Variable vs Constant

2002-05-28 Thread Miguel Cruz

Wouldn't it be a lot easier to do that with arrays?

miguel

On Tue, 28 May 2002, HPS wrote:
 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 systemthe downside will
 be even more
 
 thx
 Billy
 
 
 Hugh Danaher [EMAIL PROTECTED] wrote in message
 000701c20620$885cd2e0$017f@localhost">news:000701c20620$885cd2e0$017f@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 [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  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
  
 
 
 
 
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Variable vs Constant

2002-05-27 Thread Billy

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