public function getIpsForHost($name)
    {
        $name = strtolower($name);

        $ips = array();
        foreach (preg_split('/\r?\n/', $this->contents) as $line) {
            $parts = preg_split('/\s+/', $line);
            $ip = array_shift($parts);
            if ($parts && array_search($name, $parts) !== false) {
                // remove IPv6 zone ID (`fe80::1%lo0` => `fe80:1`)
                if (strpos($ip, ':') !== false && ($pos = strpos($ip, '%')) !== false) {
                    $ip = substr($ip, 0, $pos);
                }

                if (@inet_pton($ip) !== false) {
                    $ips[] = $ip;
                }
            }
        }

        return $ips;
    }
public function getIpsForHost($name)
    {
        $name = strtolower($name);

        $ips = array();
        foreach (preg_split('/\r?\n/', $this->contents) as $line) {
            $parts = preg_split('/\s+/', $line);
            $ip = array_shift($parts);
            if ($parts && array_search($name, $parts) !== false) {
                // remove IPv6 zone ID (`fe80::1%lo0` => `fe80:1`)
                if (strpos($ip, ':') !== false && ($pos = strpos($ip, '%')) !== false) {
                    $ip = substr($ip, 0, $pos);
                }

                if (@inet_pton($ip) !== false) {
                    $ips[] = $ip;
                }
            }
        }

        return $ips;
    }
public function getIpsForHost ( $ name ) { $ name = strtolower ( $ name ) ; $ ips = array ( ) ; foreach ( preg_split ( '/\r?\n/' , $ this -> contents ) as $ line ) { $ parts = preg_split ( '/\s+/' , $ line ) ; $ ip = array_shift ( $ parts ) ; if ( $ parts && array_search ( $ name , $ parts ) !== false ) { // remove IPv6 zone ID (`fe80::1%lo0` => `fe80:1`) if ( strpos ( $ ip , ':' ) !== false && ( $ pos = strpos ( $ ip , '%' ) ) !== false ) { $ ip = substr ( $ ip , 0 , $ pos ) ; } if ( @ inet_pton ( $ ip ) !== false ) { $ ips [ ] = $ ip ; } } } return $ ips ; }
Returns all IPs for the given hostname

@param string $name
@return string[]
Returns all IPs for the given hostname