GetOptionKit\ValueType\IpType::test PHP Method

test() public method

public test ( $value )
    public function test($value)
    {
        return filter_var($value, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_IPV6) !== false;
    }

Usage Example

Example #1
0
 public function testIpType()
 {
     $ip = new IpType();
     ok($ip->test('192.168.25.58'));
     ok($ip->test('2607:f0d0:1002:51::4'));
     ok($ip->test('::1'));
     $this->assertFalse($ip->test('10.10.15.10/16'));
 }
All Usage Examples Of GetOptionKit\ValueType\IpType::test