Derokorian;10991708 wrote:
This line doesn't make sense to me, set it to a or b... how does it know which one to set it to?
It doesn't matter. Either the entire expression is true, or it is false.
Weedpacket;10991705 wrote:Just thought I'd note that
$added = FALSE;
if( $firstopen === FALSE ) {
$added = TRUE;
} elseif( $firstclose !== FALSE && $firstclose < $firstopen ) {
$added = TRUE;
}
Derokorian;10991708 wrote:
$added = ($firstopen === FALSE) || ( $firstclose !== FALSE && $firstclose < $firstopen );
(true || whatever) => true
So, if $firstopen === false, the rest of the logical expression is not evaluated since it will always be true, and $added = true.
If $firstopen === false is false, the rest of the expression has to be evaluated. $firstclose !== false will be true (as a result of the first part being false), which leaves $firstclose < $firstopen. Thus, if $firstclose is less than $firstopen, the entire expression becomes true and $added = true.
If $firstopen !== false and $firstclose >= $firstopen, the entire expression is false and $added = false.
That is, the expression is equivalent to the conditions in the if / elseif conditions.
Also note that you could simply remove ($firstopen !== FALSE && and use the simpler and equivalent expression
$added = ($firstopen === FALSE) || ($firstclose < $firstopen);