gethostname
PHP function
Edit on GitHub ✎
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
Gets the host name
Description
gethostname(): string|false
gethostname() gets the standard host name for the local machine.
Parameters Parameters
Return Values
Returns a string with the hostname on success, otherwise false is returned.
Examples
A simple gethostname() example
php
<?php
echo gethostname(); // may output e.g,: sandie
?>