gethostname

(PHP 5 >= 5.3.0, PHP 7, PHP 8)

gethostnameGets the host name

Опис

gethostname(): string|false

gethostname() gets the standard host name for the local machine.

Параметри

У цієї функції немає параметрів.

Значення, що повертаються

Returns a string with the hostname on success, otherwise false is returned.

Приклади

Приклад #1 A simple gethostname() example

<?php
echo gethostname(); // may output e.g,: sandie
?>

Прогляньте також

  • gethostbyname() - Get the IPv4 address corresponding to a given Internet host name
  • gethostbyaddr() - Отримує назву хоста в інтернеті, відповідну до заданої IP-адреси
  • php_uname() - Returns information about the operating system PHP is running on