public function ip($message = null)
    {
        $this->setRule(__FUNCTION__, function($val)
                       {
                           return (strlen(trim($val)) === 0 || filter_var($val, FILTER_VALIDATE_IP) !== FALSE);
                       }, $message);
        return $this;
    }
public function ip($message = null)
    {
        $this->setRule(__FUNCTION__, function($val)
                       {
                           return (strlen(trim($val)) === 0 || filter_var($val, FILTER_VALIDATE_IP) !== FALSE);
                       }, $message);
        return $this;
    }
public function ip ( $ message = null ) { $ this -> setRule ( __FUNCTION__ , function ( $ val ) { return ( strlen ( trim ( $ val ) ) === 0 || filter_var ( $ val , FILTER_VALIDATE_IP ) !== FALSE ) ; } , $ message ) ; return $ this ; }
Field has to be valid IP address.

@param string $message
@return FormValidator
Field has to be valid IP address .