You can use boolval(), but it doesn’t produce correct results for “True” and “False” values.
This is the better method:
if (filter_var($MyVariable, FILTER_VALIDATE_BOOLEAN))
{
//Value is true
}
if (!filter_var($MyVariable, FILTER_VALIDATE_BOOLEAN))
{
//Value is false
}
