gethostbyname

Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Get the IPv4 address corresponding to a given Internet host name
<?php gethostbyname(string $hostname): string
<?php         if ($this->degradedMode && strpos($fileUrl, 'http://repo.packagist.org/') === 0) {


            $fileUrl = 'http://' . gethostbyname('repo.packagist.org') . substr($fileUrl, 20);

            $degradedPackagist = true;

        }
<?php $ip = gethostbyname('www.google.com');

if (ip2long($ip) === false) {

    echo 'Unable to resolve hostname' . PHP_EOL;

    exit(1);