public function validateIp($ip)
    {
        $ipnums = explode(".", $ip);
        if (count($ipnums) != 4) {
            return false;
        }
        foreach($ipnums as $ipnum) {
            if (!is_numeric($ipnum) || ($ipnum > 255)) {
                return false;
            }
        }
        return $ip;
    }
public function validateIp($ip)
    {
        $ipnums = explode(".", $ip);
        if (count($ipnums) != 4) {
            return false;
        }
        foreach($ipnums as $ipnum) {
            if (!is_numeric($ipnum) || ($ipnum > 255)) {
                return false;
            }
        }
        return $ip;
    }
public function validateIp ( $ ip ) { $ ipnums = explode ( "." , $ ip ) ; if ( count ( $ ipnums ) != 4 ) { return false ; } foreach ( $ ipnums as $ ipnum ) { if ( ! is_numeric ( $ ipnum ) || ( $ ipnum > 255 ) ) { return false ; } } return $ ip ; }
Validates if string is IP.

@param string $ip IP or domain name

@return boolean|string $ip IP or domain name
Validates if string is IP .