Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

OT: Whatsa diff? PHP

LEGEND ,
Oct 20, 2006 Oct 20, 2006
between this -

if (!$foo) {

and this -

if (!$foo && false) {

????

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================



TOPICS
Server side applications
1.4K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 20, 2006 Oct 20, 2006
I don' know that a Boolean var could be empty...if it could, then you second
statement would verify it was not empty and yet not true, yes?


"Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
news:ehb6d7$4pl$1@forums.macromedia.com...
> between this -
>
> if (!$foo) {
>
> and this -
>
> if (!$foo && false) {
>
> ????
>
> --
> Murray --- ICQ 71997575
> Adobe Community Expert
> (If you *MUST* email me, don't LAUGH when you do so!)
> ==================
> http://www.dreamweavermx-templates.com - Template Triage!
> http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
> http://www.dwfaq.com - DW FAQs, Tutorials & Resources
> http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
> ==================
>
>
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 20, 2006 Oct 20, 2006
Not sure - was just askin' to inform myself.

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"crash" <crash@bcdcdigital.com> wrote in message
news:ehb6ho$4tr$1@forums.macromedia.com...
>I don' know that a Boolean var could be empty...if it could, then you
>second statement would verify it was not empty and yet not true, yes?
>
>
> "Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
> news:ehb6d7$4pl$1@forums.macromedia.com...
>> between this -
>>
>> if (!$foo) {
>>
>> and this -
>>
>> if (!$foo && false) {
>>
>> ????
>>
>> --
>> Murray --- ICQ 71997575
>> Adobe Community Expert
>> (If you *MUST* email me, don't LAUGH when you do so!)
>> ==================
>> http://www.dreamweavermx-templates.com - Template Triage!
>> http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
>> http://www.dwfaq.com - DW FAQs, Tutorials & Resources
>> http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
>> ==================
>>
>>
>>
>
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 20, 2006 Oct 20, 2006
Murray *ACE* wrote:
> between this -
>
> if (!$foo) {
>
> and this -
>
> if (!$foo && false) {

I suspect you have been looking at some Dreamweaver code (in the User
Authentication server behavior). It's puzzled me for some time, but I
think the && false simply prevents the conditional from ever running.

In the case of the Log In User SB, && false is added if you don't want
to set entry according to access levels. If you do want access levels,
it's set to && true.

It's a strange way of coding it. If someone else has a better
explanation, I'd love to hear it.

--
David Powers
Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
http://foundationphp.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 20, 2006 Oct 20, 2006
.oO(Murray *ACE*)

>between this -
>
>if (!$foo) {
>
>and this -
>
>if (!$foo && false) {

The condition in the second example will _always_ be FALSE, regardless
of the value of $foo. The code in this block will never be executed.

Micha
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 20, 2006 Oct 20, 2006
That's how it seems. Thanks, Micha!

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"Michael Fesser" <netizen@gmx.de> wrote in message
news:m99ij2h6619scr9bh6rve6h98pcl6aokf2@4ax.com...
> .oO(Murray *ACE*)
>
>>between this -
>>
>>if (!$foo) {
>>
>>and this -
>>
>>if (!$foo && false) {
>
> The condition in the second example will _always_ be FALSE, regardless
> of the value of $foo. The code in this block will never be executed.
>
> Micha


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 20, 2006 Oct 20, 2006
Yeah - that's where it is allright....

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"David Powers" <david@example.com> wrote in message
news:ehb843$6to$1@forums.macromedia.com...
> Murray *ACE* wrote:
>> between this -
>>
>> if (!$foo) {
>>
>> and this -
>>
>> if (!$foo && false) {
>
> I suspect you have been looking at some Dreamweaver code (in the User
> Authentication server behavior). It's puzzled me for some time, but I
> think the && false simply prevents the conditional from ever running.
>
> In the case of the Log In User SB, && false is added if you don't want to
> set entry according to access levels. If you do want access levels, it's
> set to && true.
>
> It's a strange way of coding it. If someone else has a better explanation,
> I'd love to hear it.
>
> --
> David Powers
> Adobe Community Expert
> Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
> http://foundationphp.com/


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 20, 2006 Oct 20, 2006
So it's like it puts that code in no matter what, and just toggle's that
"option" if you wish to authenticate by levels?

that does seem strange. thanks for explanation - thanks murry for the
quesiton! :O)


"David Powers" <david@example.com> wrote in message
news:ehb843$6to$1@forums.macromedia.com...
> Murray *ACE* wrote:
>> between this -
>>
>> if (!$foo) {
>>
>> and this -
>>
>> if (!$foo && false) {
>
> I suspect you have been looking at some Dreamweaver code (in the User
> Authentication server behavior). It's puzzled me for some time, but I
> think the && false simply prevents the conditional from ever running.
>
> In the case of the Log In User SB, && false is added if you don't want to
> set entry according to access levels. If you do want access levels, it's
> set to && true.
>
> It's a strange way of coding it. If someone else has a better explanation,
> I'd love to hear it.
>
> --
> David Powers
> Adobe Community Expert
> Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
> http://foundationphp.com/


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 20, 2006 Oct 20, 2006
It's weird - but I actually READ what they put on the page! 8)

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"crash" <crash@bcdcdigital.com> wrote in message
news:ehb9nf$8ne$1@forums.macromedia.com...
> So it's like it puts that code in no matter what, and just toggle's that
> "option" if you wish to authenticate by levels?
>
> that does seem strange. thanks for explanation - thanks murry for the
> quesiton! :O)
>
>
> "David Powers" <david@example.com> wrote in message
> news:ehb843$6to$1@forums.macromedia.com...
>> Murray *ACE* wrote:
>>> between this -
>>>
>>> if (!$foo) {
>>>
>>> and this -
>>>
>>> if (!$foo && false) {
>>
>> I suspect you have been looking at some Dreamweaver code (in the User
>> Authentication server behavior). It's puzzled me for some time, but I
>> think the && false simply prevents the conditional from ever running.
>>
>> In the case of the Log In User SB, && false is added if you don't want to
>> set entry according to access levels. If you do want access levels, it's
>> set to && true.
>>
>> It's a strange way of coding it. If someone else has a better
>> explanation, I'd love to hear it.
>>
>> --
>> David Powers
>> Adobe Community Expert
>> Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
>> http://foundationphp.com/
>
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 20, 2006 Oct 20, 2006
I did too, smartass! 8oP

I just want to repeat and make sure I understood. Honestly, that sounds
like you should just remove the code block, then, instead of dealing with
it. If it doesn't do anything, why have it compile?

i've had too strange of a week. did you see that problem posted today?
crazy crazy crazy. i'm repeating things back to everybody lately, just to
make sure.


"Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
news:ehb9tv$92k$1@forums.macromedia.com...
> It's weird - but I actually READ what they put on the page! 8)
>
> --
> Murray --- ICQ 71997575
> Adobe Community Expert
> (If you *MUST* email me, don't LAUGH when you do so!)
> ==================
> http://www.dreamweavermx-templates.com - Template Triage!
> http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
> http://www.dwfaq.com - DW FAQs, Tutorials & Resources
> http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
> ==================
>
>
> "crash" <crash@bcdcdigital.com> wrote in message
> news:ehb9nf$8ne$1@forums.macromedia.com...
>> So it's like it puts that code in no matter what, and just toggle's that
>> "option" if you wish to authenticate by levels?
>>
>> that does seem strange. thanks for explanation - thanks murry for the
>> quesiton! :O)
>>
>>
>> "David Powers" <david@example.com> wrote in message
>> news:ehb843$6to$1@forums.macromedia.com...
>>> Murray *ACE* wrote:
>>>> between this -
>>>>
>>>> if (!$foo) {
>>>>
>>>> and this -
>>>>
>>>> if (!$foo && false) {
>>>
>>> I suspect you have been looking at some Dreamweaver code (in the User
>>> Authentication server behavior). It's puzzled me for some time, but I
>>> think the && false simply prevents the conditional from ever running.
>>>
>>> In the case of the Log In User SB, && false is added if you don't want
>>> to set entry according to access levels. If you do want access levels,
>>> it's set to && true.
>>>
>>> It's a strange way of coding it. If someone else has a better
>>> explanation, I'd love to hear it.
>>>
>>> --
>>> David Powers
>>> Adobe Community Expert
>>> Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
>>> http://foundationphp.com/
>>
>>
>
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 20, 2006 Oct 20, 2006
Michael Fesser wrote:
> The condition in the second example will _always_ be FALSE, regardless
> of the value of $foo. The code in this block will never be executed.

Thanks for confirming that, Micha. As I correctly guessed, Murray had
been looking at the way the Dreamweaver Log In User server behavior is
coded for PHP. The && false prevents the server behavior adding the
check for access levels. What I've not been able to ascertain is whether
this is just something the Dreamweaver team decided to use simply
because it works or whether it's a commonly accepted technique.

--
David Powers
Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
http://foundationphp.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 20, 2006 Oct 20, 2006
What's the advantage? In what instance would it be useful? And yes, I read
the thread Murray! ;o)


"David Powers" <david@example.com> wrote in message
news:ehbh8h$hn0$1@forums.macromedia.com...
> Michael Fesser wrote:
>> The condition in the second example will _always_ be FALSE, regardless
>> of the value of $foo. The code in this block will never be executed.
>
> Thanks for confirming that, Micha. As I correctly guessed, Murray had been
> looking at the way the Dreamweaver Log In User server behavior is coded
> for PHP. The && false prevents the server behavior adding the check for
> access levels. What I've not been able to ascertain is whether this is
> just something the Dreamweaver team decided to use simply because it works
> or whether it's a commonly accepted technique.
>
> --
> David Powers
> Adobe Community Expert
> Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
> http://foundationphp.com/


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 20, 2006 Oct 20, 2006
.oO(David Powers)

>What I've not been able to ascertain is whether
>this is just something the Dreamweaver team decided to use simply
>because it works or whether it's a commonly accepted technique.

From a programmer's point of view I consider it really bad style, so
it's rather a DW team decision. Maybe it makes life easier for them, but
it's very ugly.

Micha
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 20, 2006 Oct 20, 2006
crash wrote:
> What's the advantage? In what instance would it be useful?

The Dreamweaver Log In User server behavior shows how it's useful. It
offers the option of controlling access according to access levels. If
you select the option to do so, Dreamweaver adds && true into the
conditional statement, so the code block is executed. If you select the
option not to control access by access levels, it inserts && false.

The effect of inserting && false is that the code block is always
ignored. As far as I can see, it's simply a shorthand way of saying
"always ignore this block". Dreamweaver could have created a different
Boolean, such as $checkAccessLevel and set it to true or false. To my
mind, doing so would have been easier to understand, but the result is
the same.

--
David Powers
Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
http://foundationphp.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 23, 2006 Oct 23, 2006
If I'm understanding it, it looks like the DW program wants to put in this
code block and simply turn it on or off according to if level is checked or
not. While I can understand why you would want such a feature as a
programmer, to me the code block not being used seems very strange an
inefficient - ie, I can see how it would be easier to program this way, but
don't necessarily understand how the code could be better this way (only see
the possible need).

Thanks for explanations,

Jon
"David Powers" <david@example.com> wrote in message
news:ehbj1f$jpf$1@forums.macromedia.com...
> crash wrote:
>> What's the advantage? In what instance would it be useful?
>
> The Dreamweaver Log In User server behavior shows how it's useful. It
> offers the option of controlling access according to access levels. If you
> select the option to do so, Dreamweaver adds && true into the conditional
> statement, so the code block is executed. If you select the option not to
> control access by access levels, it inserts && false.
>
> The effect of inserting && false is that the code block is always ignored.
> As far as I can see, it's simply a shorthand way of saying "always ignore
> this block". Dreamweaver could have created a different Boolean, such as
> $checkAccessLevel and set it to true or false. To my mind, doing so would
> have been easier to understand, but the result is the same.
>
> --
> David Powers
> Adobe Community Expert
> Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
> http://foundationphp.com/


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 23, 2006 Oct 23, 2006
So, if I have a variable named $foo, then

if (!$foo && false)

wouldn't that work when $foo=false?

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"crash" <crash@bcdcdigital.com> wrote in message
news:ehinef$289$1@forums.macromedia.com...
> If I'm understanding it, it looks like the DW program wants to put in this
> code block and simply turn it on or off according to if level is checked
> or not. While I can understand why you would want such a feature as a
> programmer, to me the code block not being used seems very strange an
> inefficient - ie, I can see how it would be easier to program this way,
> but don't necessarily understand how the code could be better this way
> (only see the possible need).
>
> Thanks for explanations,
>
> Jon
> "David Powers" <david@example.com> wrote in message
> news:ehbj1f$jpf$1@forums.macromedia.com...
>> crash wrote:
>>> What's the advantage? In what instance would it be useful?
>>
>> The Dreamweaver Log In User server behavior shows how it's useful. It
>> offers the option of controlling access according to access levels. If
>> you select the option to do so, Dreamweaver adds && true into the
>> conditional statement, so the code block is executed. If you select the
>> option not to control access by access levels, it inserts && false.
>>
>> The effect of inserting && false is that the code block is always
>> ignored. As far as I can see, it's simply a shorthand way of saying
>> "always ignore this block". Dreamweaver could have created a different
>> Boolean, such as $checkAccessLevel and set it to true or false. To my
>> mind, doing so would have been easier to understand, but the result is
>> the same.
>>
>> --
>> David Powers
>> Adobe Community Expert
>> Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
>> http://foundationphp.com/
>
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 23, 2006 Oct 23, 2006
Murray *ACE* wrote:
> So, if I have a variable named $foo, then
>
> if (!$foo && false)
>
> wouldn't that work when $foo=false?

If $foo is false, !$foo is true. So that equates to if (true && false),
which would not execute the code in the conditional statement.

If $foo is true, !$foo is false. So that equates to if (false && false),
which still would not execute the code, because a condition *must*
equate to true.

The Dreamweaver code would be much easier to understand if the && false
were replaced by $accessLevelRequired. You would then need to set the
value of $accessLevelRequired explicitly to either true or false.

--
David Powers
Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
http://foundationphp.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 23, 2006 Oct 23, 2006
Doesn't false && false equate to true?

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"David Powers" <david@example.com> wrote in message
news:ehiotu$418$1@forums.macromedia.com...
> Murray *ACE* wrote:
>> So, if I have a variable named $foo, then
>>
>> if (!$foo && false)
>>
>> wouldn't that work when $foo=false?
>
> If $foo is false, !$foo is true. So that equates to if (true && false),
> which would not execute the code in the conditional statement.
>
> If $foo is true, !$foo is false. So that equates to if (false && false),
> which still would not execute the code, because a condition *must* equate
> to true.
>
> The Dreamweaver code would be much easier to understand if the && false
> were replaced by $accessLevelRequired. You would then need to set the
> value of $accessLevelRequired explicitly to either true or false.
>
> --
> David Powers
> Adobe Community Expert
> Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
> http://foundationphp.com/


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 23, 2006 Oct 23, 2006
Murray *ACE* wrote:
> Doesn't false && false equate to true?

Do two wrongs make a right?

No, false is false, is false. The way that a conditional statement works
is by considering each condition from left to right. If the statement
uses &&, both conditions must be true, so it stops as soon as it reaches
the first false. If using ||, only one condition needs to be fulfilled,
so testings stops as soon as one turns out to be true.

--
David Powers
Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
http://foundationphp.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 23, 2006 Oct 23, 2006
If (false) is false?

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"David Powers" <david@example.com> wrote in message
news:ehiqjn$66q$1@forums.macromedia.com...
> Murray *ACE* wrote:
>> Doesn't false && false equate to true?
>
> Do two wrongs make a right?
>
> No, false is false, is false. The way that a conditional statement works
> is by considering each condition from left to right. If the statement uses
> &&, both conditions must be true, so it stops as soon as it reaches the
> first false. If using ||, only one condition needs to be fulfilled, so
> testings stops as soon as one turns out to be true.
>
> --
> David Powers
> Adobe Community Expert
> Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
> http://foundationphp.com/


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 23, 2006 Oct 23, 2006
Murray *ACE* wrote:
> If (false) is false?

The expression inside the parentheses *must* equate to true. End of story.

http://www.php.net/manual/en/language.control-structures.php

--
David Powers
Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
http://foundationphp.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 23, 2006 Oct 23, 2006
More like this, I think:

if(!$foo && false){

If (condittion1 ever equals false, die) AND (condition 2 ever equals false,
die).

if(!$foo OR false){

means one condition could be false, one can be true. The two conditions are
really sepearte of each other, as I understand it.



"Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
news:ehiqm0$699$1@forums.macromedia.com...
> If (false) is false?
>
> --
> Murray --- ICQ 71997575
> Adobe Community Expert
> (If you *MUST* email me, don't LAUGH when you do so!)
> ==================
> http://www.dreamweavermx-templates.com - Template Triage!
> http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
> http://www.dwfaq.com - DW FAQs, Tutorials & Resources
> http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
> ==================
>
>
> "David Powers" <david@example.com> wrote in message
> news:ehiqjn$66q$1@forums.macromedia.com...
>> Murray *ACE* wrote:
>>> Doesn't false && false equate to true?
>>
>> Do two wrongs make a right?
>>
>> No, false is false, is false. The way that a conditional statement works
>> is by considering each condition from left to right. If the statement
>> uses &&, both conditions must be true, so it stops as soon as it reaches
>> the first false. If using ||, only one condition needs to be fulfilled,
>> so testings stops as soon as one turns out to be true.
>>
>> --
>> David Powers
>> Adobe Community Expert
>> Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
>> http://foundationphp.com/
>
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 23, 2006 Oct 23, 2006
On 23 Oct 2006 in macromedia.dreamweaver.appdev, Murray *ACE* wrote:

> Doesn't false && false equate to true?

Nope.

Cond1 Cond2 Cond1 && Cond2
T T T
F T F
T F F
F F F

XNOR (eXclusive NOR) will do what you're thinking of:

http://en.wikipedia.org/wiki/Truth_table
http://en.wikipedia.org/wiki/Exclusive_nor
--
Joe Makowiec
http://makowiec.net/
Email: http://makowiec.net/email.php
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 23, 2006 Oct 23, 2006
Ahh - gotcha. That's one that always troubles me. Thanks!

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"Joe Makowiec" <makowiec@invalid.invalid> wrote in message
news:Xns986582EE6274AmakowiecatnycapdotrE@216.104.212.96...
> On 23 Oct 2006 in macromedia.dreamweaver.appdev, Murray *ACE* wrote:
>
>> Doesn't false && false equate to true?
>
> Nope.
>
> Cond1 Cond2 Cond1 && Cond2
> T T T
> F T F
> T F F
> F F F
>
> XNOR (eXclusive NOR) will do what you're thinking of:
>
> http://en.wikipedia.org/wiki/Truth_table
> http://en.wikipedia.org/wiki/Exclusive_nor
> --
> Joe Makowiec
> http://makowiec.net/
> Email: http://makowiec.net/email.php


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 23, 2006 Oct 23, 2006
LATEST
> I suspect you have been looking at some Dreamweaver code (in the User
> Authentication server behavior). It's puzzled me for some time, but I
> think the && false simply prevents the conditional from ever running.
>
> In the case of the Log In User SB, && false is added if you don't want to
> set entry according to access levels. If you do want access levels, it's
> set to && true.
>
> It's a strange way of coding it. If someone else has a better explanation,
> I'd love to hear it.


The reason is to make coding for server behaviors easier -- it's easier for
the server behavior to insert a true/false than it is to try to
conditionally show blocks of code. It's purely for DW's benefit.


--
--
Tom Muck
co-author Dreamweaver MX 2004: The Complete Reference
http://www.tom-muck.com/

Cartweaver Development Team
http://www.cartweaver.com

Extending Knowledge Daily
http://www.communitymx.com/


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines