protected function isValidIpAddress($ip)
    {
        $flags = FILTER_FLAG_IPV4 | FILTER_FLAG_IPV6;
        if (filter_var($ip, FILTER_VALIDATE_IP, $flags) === false) {
            return false;
        }
        return true;
    }
protected function isValidIpAddress($ip)
    {
        $flags = FILTER_FLAG_IPV4 | FILTER_FLAG_IPV6;
        if (filter_var($ip, FILTER_VALIDATE_IP, $flags) === false) {
            return false;
        }
        return true;
    }
protected function isValidIpAddress ( $ ip ) { $ flags = FILTER_FLAG_IPV4 | FILTER_FLAG_IPV6 ; if ( filter_var ( $ ip , FILTER_VALIDATE_IP , $ flags ) === false ) { return false ; } return true ; }
Check that a given string is a valid IP address

@param  string  $ip
@return boolean
Check that a given string is a valid IP address