PHP
True and False values
In PHP, there are some rules for a boolean evaluation:
- for numeric values:
- 0 is false
- anything else is true
- for string values:
- the empty string is false
- "0" is evaluated to false
- all else is true
- for an array
- an empty array is false
- an array with any elements is true
- for an object
- an empty object (no defined methods or functions) is false
- true otherwise
PHP provides 2 built-in constants:
- TRUE defined as the integer value 1
- FALSE defined as the empty string
Assignment, Equality and Identity
PHP defines 3 operations with its own operator:
- "=" assign a value to a variable
- "==" compares the values of 2 operands.
- "===" compares their values and their types
"==" and "===" do not work on arrays or objects.


