Re: [PHP] define (true/false)

2005-07-28 Thread Jochem Maas
Sebastian wrote: i never really used constants before so this may sound stupid.. you could use constants and still sound stupid. - that would be 'constantly sounding stupid' ;-) when you define a constant using define() and want to return true/false is this logical: yes, if a little

Re: [PHP] define (true/false)

2005-07-28 Thread André Medeiros
On Wed, 2005-07-27 at 17:17 -0400, Sebastian wrote: i never really used constants before so this may sound stupid.. when you define a constant using define() and want to return true/false is this logical: if($bars == 3) { define('BAR', 1); } then: if(BAR) { // bars is

Re: [PHP] define (true/false)

2005-07-28 Thread Jochem Maas
André Medeiros wrote: On Wed, 2005-07-27 at 17:17 -0400, Sebastian wrote: i never really used constants before so this may sound stupid.. when you define a constant using define() and want to return true/false is this logical: if($bars == 3) { define('BAR', 1); } then: if(BAR) { ...

RE: [PHP] define (true/false)

2005-07-28 Thread Jay Blanchard
[snip] if($bars == 3) { define('BAR', 1); } then: if(BAR) { That's an incorrect use for constants. Use variables for that =] WHY? [/snip] Because the constant can be variable in this case. Consider (this is old school, and we all know that I am the definition of old school) the definition

Re: [PHP] define (true/false)

2005-07-28 Thread André Medeiros
On Thu, 2005-07-28 at 14:41 +0200, Jochem Maas wrote: André Medeiros wrote: On Wed, 2005-07-27 at 17:17 -0400, Sebastian wrote: i never really used constants before so this may sound stupid.. when you define a constant using define() and want to return true/false is this logical:

Re: [PHP] define (true/false)

2005-07-28 Thread Vidyut Luther
Exactly, CONSTANTS are ... eternal truths to the program, they shouldn't change, constants should not be changing based on arguments being passed, or other variables. by definition, it's no longer a constant, and a misuse of the define () function. On Jul 28, 2005, at 8:46 AM, Jay

Re: [PHP] define (true/false)

2005-07-28 Thread John Nichel
Sebastian wrote: i never really used constants before so this may sound stupid.. when you define a constant using define() and want to return true/false is this logical: if($bars == 3) { define('BAR', 1); } then: if(BAR) { // bars is true } or should i need to do an else statement as

Re: [PHP] define (true/false)

2005-07-28 Thread John Nichel
Jay Blanchard wrote: [snip] if($bars == 3) { define('BAR', 1); } then: if(BAR) { That's an incorrect use for constants. Use variables for that =] WHY? [/snip] Because the constant can be variable in this case. Consider (this is old school, and we all know that I am the definition of

Re: [PHP] define (true/false)

2005-07-28 Thread Jochem Maas
John Nichel wrote: Jay Blanchard wrote: [snip] if($bars == 3) { define('BAR', 1); } then: if(BAR) { That's an incorrect use for constants. Use variables for that =] WHY? [/snip] Because the constant can be variable in this case. Consider (this is old school, and we all know that

Re: [PHP] define (true/false)

2005-07-28 Thread Edward Vermillion
John Nichel wrote: Jay Blanchard wrote: [snip] never want to use a variable to determine a constant because the variable is not likely to be the same (that is why we call them variables) on any iteration. Using constants in expressions is OK, for instance if(BAR == $foo){ ...stuff... }

Re: [PHP] define (true/false)

2005-07-28 Thread John Nichel
Jochem Maas wrote: now that was exactly my reasoning ... but I very much appriciate the input of the more experienced/older/classically-trained (as apposed to my completely -self-taught-not-backed-up-with-any-solid-computer-science-theory-skills) guys out there (hey Jay it's a compliment ;-)

Re: [PHP] define (true/false)

2005-07-28 Thread Vidyut Luther
On Jul 28, 2005, at 9:41 AM, Edward Vermillion wrote: [snip] I may be misunderstanding you here, but I don't see why you would not want to use a variable to define a constant. I do it from time to time, most common would be in a config document where I'll check if the page is being

RE: [PHP] define (true/false)

2005-07-28 Thread Jay Blanchard
[snip] I may be misunderstanding you here, but I don't see why you would not want to use a variable to define a constant. I do it from time to time, most common would be in a config document where I'll check if the page is being accessed via http or https, and define a constant based on

RE: [PHP] define (true/false)

2005-07-28 Thread Jay Blanchard
[snip] now that was exactly my reasoning ... but I very much appriciate the input of the more experienced/older/classically-trained (as apposed to my completely -self-taught-not-backed-up-with-any-solid-computer-science-theory-skills ) guys out there (hey Jay it's a compliment ;-) Jay's

[PHP] define (true/false)

2005-07-27 Thread Sebastian
i never really used constants before so this may sound stupid.. when you define a constant using define() and want to return true/false is this logical: if($bars == 3) { define('BAR', 1); } then: if(BAR) { // bars is true } or should i need to do an else statement as well: if($bars

Re: [PHP] define (true/false)

2005-07-27 Thread comex
i never really used constants before so this may sound stupid.. when you define a constant using define() and want to return true/false is this logical: http://us2.php.net/defined -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php