Weak logic operators

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Heya,

 

I was just wondering for what reason PHP has weak logic operators.

So far I have only used the weak logic operator 'or' in the following situation:

 

foo() or die("nooo");

 

And it is quite a long time ago I have use it this way. You could also write the following instead:

 

if(!foo()){

  die("noooo");

}

 

I am aware of that one can use 'or' and 'and' as substitute for || and && if using brackets in addition:

 

$a = ( foo() and bar() );

 

But I don't really see the benefit of that except that there is no alternative for xor. So the following could make
sense - I have never used it though:

$a = ( foo() xor bar() );

 

So I am curious, are there other use cases out there?

 

Cheers,

Robert


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux