PHP | gethostbyaddr() Function

PHP gethostbyaddr() Function

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 gethostbyaddr() Function.

The built-in PHP gethostbyaddr() function is used for getting the internet host name corresponding to the specified IP Address.


Following below is the syntax to use this function -

string gethostbyaddr ( string $ip_address )

Parameter Details

Sr.NoParameters & Description


It will host the IP Address

Return Value

This PHP function returns the internet host name.


Try out the following example below -

   $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
   echo $hostname;

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 gethostbynamel() 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.