[PHP] Re: CONSTANTS and good coding practice

2004-05-21 Thread Al
Many thanks everyone. Seems like I should be using constants a lot of places where I've been using globals. Al wrote: Can someone explain to me the value of using defined custom constants, in the context of good coding practice. I don't recall ever seeing define() used in the scripts I've see

Re: [PHP] Re: CONSTANTS and good coding practice

2004-05-21 Thread Curt Zirzow
* Thus wrote Greg Donald ([EMAIL PROTECTED]): > On Fri, 2004-05-21 at 08:37, Richard Davey wrote: > > Absolutely - and one of the best features of constants is their scope > > - being global in nature you can use them ANYWHERE which is very handy > > indeed! > > ANYWHERE except in code you plan to

[PHP] Re: CONSTANTS and good coding practice

2004-05-21 Thread Craig
yes, constants have global scope also :-) "Craig" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Have a look here also: http://ie2.php.net/define > > > "Al" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > Can someone explain to me the value of using defined custom

Re: [PHP] Re: CONSTANTS and good coding practice

2004-05-21 Thread Greg Donald
On Fri, 2004-05-21 at 08:37, Richard Davey wrote: > Absolutely - and one of the best features of constants is their scope > - being global in nature you can use them ANYWHERE which is very handy > indeed! ANYWHERE except in code you plan to eval(). Funny how get_defined_constants() knows about al

Re: [PHP] Re: CONSTANTS and good coding practice

2004-05-21 Thread Richard Davey
Hello Craig, Friday, May 21, 2004, 2:30:20 PM, you wrote: C> Constants are useful when a variable will remain exactly the same C> (constant) through the life of a script. Absolutely - and one of the best features of constants is their scope - being global in nature you can use them ANYWHERE whic

[PHP] Re: CONSTANTS and good coding practice

2004-05-21 Thread Craig
Have a look here also: http://ie2.php.net/define "Al" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Can someone explain to me the value of using defined custom constants, > in the context of good coding practice. > > I don't recall ever seeing define() used in the scripts I've see

[PHP] Re: CONSTANTS and good coding practice

2004-05-21 Thread Craig
Constants are useful when a variable will remain exactly the same (constant) through the life of a script. e.g a script I wrote to calculate dates be it in the past or future would have constant values for how many seconds are in a day or a week. to be used in calculations. e.g: define("SECONDSIN