note 101040 added to function.gethostname
| From: | radon8472 at radon-software dot net | Date: | Mon, 22 Nov 2010 18:44:44 +0000 |
| Subject: | note 101040 added to function.gethostname | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-174263@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 212.124.37.9
Probable Submitter: 92.195.17.253
----
Manual Page -- http://www.php.net/manual/en/function.gethostname.php
Edit -- https://master.php.net/note/edit/101040
Del: integrated -- https://master.php.net/note/delete/101040/integrated
Del: useless -- https://master.php.net/note/delete/101040/useless
Del: bad code -- https://master.php.net/note/delete/101040/bad+code
Del: spam -- https://master.php.net/note/delete/101040/spam
Del: non-english -- https://master.php.net/note/delete/101040/non-english
Del: in docs -- https://master.php.net/note/delete/101040/in+docs
Del: other reasons-- https://master.php.net/note/delete/101040
Reject -- https://master.php.net/note/reject/101040
Search -- https://master.php.net/manage/user-notes.php