Weak logic operators

From: Date: Tue, 25 Mar 2014 00:11:35 +0000
Subject: Weak logic operators
Groups: php.general 
Request: Send a blank email to php-general+get-323107@lists.php.net to get a copy of this message
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

« previous php.general (#323107) next »