[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
[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
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 acces
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 ;-)
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...
}
But
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 I
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 o
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
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 Bl
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 log
[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 scho
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)
{
...
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)
> {
> /
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 verbose
> 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
15 matches
Mail list logo