note 7836 deleted from function.gethostbyname by didou
| From: | didou@php.net | Date: | Fri, 27 Feb 2004 15:58:57 +0000 |
| Subject: | note 7836 deleted from function.gethostbyname by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-65894@lists.php.net to get a copy of this message | ||
Note Submitter: leingang@math.harvard.edu
----
To take spiceee's note to the next step, if you want to check whether a string $hostname that
"looks like" a hostname (i.e., matches the correct regexp) IS a valid host, do not check
on the truth value of gethostbyname($hostname)! This will always be true. Instead do
if (gethostbyname($hostname) == $hostname) {
echo "Bad boy! No such host!"
}