[PHP] Re: Constants in strings

2011-07-06 Thread Geoff Lane
On Wednesday, July 6, 2011, Dave Wilson wrote: > OK. We all know that constants cannot be accessed directly via their > name in double-quoted or heredoc strings. FWIW, this looked like it might be a right royal PITA for me ATM. However, I've got a work-around. With about a dozen scripts written

[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

[PHP] Re: Constants

2004-03-23 Thread Jakes
You can keep constant variables in an interface, because thay are static and do not change. Trust me, it is a bug. "Gerben" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > this is probably because Foo is an interface instead of a class. interfaces > can't contain any data as far as I

[PHP] Re: Constants

2004-03-23 Thread Gerben
this is probably because Foo is an interface instead of a class. interfaces can't contain any data as far as I know. "Jakes" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > The bug server looks like its down, so I will just post the bug here, and > hopefully someone > will spot it >