print utilityValidateBoolean

Validates that a variable is a boolean, optionally can be set to validate only strict boolean values (false|true). Default is to compare against a list of representations of boolean values.

// just use defaults so the string: "no" is considered boolean (false)
$oValidator = new utilityValidateBoolean(
    array(
        // use defaults
);
if ( $oValidator->isValid('No') ) {
    // is boolean
}

// validate that var is a strict boolean
$oValidator = new utilityValidateBoolean(
    array(
        utilityValidateBoolean::STRICT_CHECK => true,
    )
);
if ( !$oValidator->isValid($bool) ) {
    print_r($oValidator->getMessages());
}

Methods


Inherited Methods

<  1  >