Hello folks! welcome back to a new edition of our tutorial on PHP. In this tutorial guide, we are going to be studying about the PHP gethostname() Function.
The built-in PHP gethostname() function is used to get the host or domain name for the local machine.
The built-in PHP gethostname() function is used to get the host or domain name for the local machine.
Syntax
Following below is the syntax to use this function -
string gethostname ( void )
Parameter Details
This built-in PHP function doesn't accept any parameters.
Return Value
This PHP function returns a string value of host name on success, otherwise FALSE on failure.
Example
Try out the following example below -
<?PHP $var = gethostname(); IF ($var===FALSE) { echo "The function ran but no results were returned!"; } ELSE { echo "The function returned a value "; echo $var; } ?>
Output
When the above code is executed, it will produce the following result below -
The function returned a value 4d623edc62d4
Alright guys! This is where we are going to be rounding up for this tutorial post. In our next tutorial, we will study about the PHP getmxrr() Function.
Do feel free to ask your questions where necessary and we will attend to them as soon as possible. If this tutorial was helpful to you, you can use the share button to share this tutorial.
Do follow us on our various social media handles available and also subscribe to our newsletter to get our tutorial posts delivered directly to your emails.
Thanks for reading and bye for now.
Do feel free to ask your questions where necessary and we will attend to them as soon as possible. If this tutorial was helpful to you, you can use the share button to share this tutorial.
Do follow us on our various social media handles available and also subscribe to our newsletter to get our tutorial posts delivered directly to your emails.
Thanks for reading and bye for now.