Validation::boolean PHP Method

boolean() public static method

public static boolean ( $value )
    public static function boolean($value)
    {
        $boolean = array(0, 1, '0', '1', true, false);
        return in_array($value, $boolean, true);
    }

Usage Example

Example #1
0
 /**
  * @testdox boolean should return false to true as string
  */
 public function testInvalidBooleanWithTrue()
 {
     $value = 'true';
     $this->assertFalse(Validation::boolean($value));
 }
All Usage Examples Of Validation::boolean