• PHP Video Tutorials

PHP - Function gethostname



Syntax

string gethostname ( void )

Definition and Usage

It is used to get the host name

Return Values

It will return string value of host name of success or else gives False on failure

Example

Try out following example

<?PHP
   $var = gethostname();
   
   IF ($var===FALSE) {
      echo "The function ran but no results were returned!";
   } ELSE {
      echo "The function returned a value ";
      echo $var;
   }
?>

Above Example gives the result as follows

The function returned a value 4d623edc62d4
php_function_reference.htm
Advertisements