Boolean
Boolean — The Boolean object is an object wrapper for a boolean value.
Description
new Boolean(mixed bool)
Parameters
Name | Description | Type | Default | Optional |
---|---|---|---|---|
bool | mixed | No |
Examples
Example #1 – boolean example
When creating a boolean object, you have to check the value of the object. The object itself will always return true.
This however does not apply when working with boolean primitives.
Example #2 – boolean example
Convert a non-boolean value to a boolean primitive.