Skip to content
Related Articles

Related Articles

PHP | gethostbyaddr() function
  • Last Updated : 29 Aug, 2019

The gethostbyaddr() function is an inbuilt function in PHP which returns domain name for a specified IP address.



Parameter: This function accepts one parameter as mentioned above and described below:

  • $ip_address: It is required parameter. It specifies IP address whose host name to be found. Passed as a string.

Return Value:

  • This function returns hostname on success and IP address on failure.


  • This function is available for PHP 4.0.0 and newer version.


$host = gethostbyaddr("");
echo $host;



Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up
Recommended Articles
Page :