note 101040 deleted from function.gethostname by danbrown
| From: | danbrown@php.net | Date: | Mon, 22 Nov 2010 19:08:04 +0000 |
| Subject: | note 101040 deleted from function.gethostname by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-174265@lists.php.net to get a copy of this message | ||
Note Submitter: radon8472 at radon-software dot net
----
Based on JPs idea i have created this:
<?php
/**
* replaces gethostname() if it doesn`?t exist - gethostname() gets the standard host name for
the local machine.
*
* @author: Radon8472
* @version: 1.0 (2010-11-22)
*
* @return: bool Returns a string with the hostname on success, otherwise FALSE is
returned.
*/
if(!function_exists("gethostname"))
{
function gethostname()
{
return php_uname("n");
}
}
?>
It returns an uppercase hostname in WinXp, maybe you could a an strtolower() before returnig the
Hostname.