ph_and PowerHome formula function
Description
Bitwise (binary) AND’s two numbers.
Syntax
ph_and ( val1, val2 )
Argument Description
val1 Long. Unsigned long value of the first operand.
val2 Long. Unsigned long value of the second operand.
Return value
Unsigned long. Returns the value of the two operands AND’ed together.
Usage
Used to compare boolean values to determine if both are true, or not. Can also be used to mask bits from a binary value. See examples below.

In addition to the ph_and() function, the stand-alone AND operator is also available for use in boolean testing, typically in IF functions. Using the AND operator this way often makes code more 'readable' and has the added advantage that more than only two variables can be compared.

A typical use of the AND operator in an IF function is...
• if(Now()>09:00:00 and {DARK}=0 and {HOME}=1,1,0)
Examples
The following examples demonstrate typical syntax/usage for this function.
ph_and({DARK},{HOME}) Yields a "1" if both the DARK and HOME Globals are true (ie, equal to 1)
ph_and(17,1) Yields "1"   {0b10001 AND 0b00001 >> 1}
ph_and(21, [LOCAL1]) Yields "1" if LOCAL1=3   {0b10101 AND 0b00011 >> 1}