PHP | gethostbyaddr() function
The gethostbyaddr() function is an inbuilt function in PHP which returns domain name for a specified IP address.
Syntax:
gethostbyaddr($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.
Note:
- This function is available for PHP 4.0.0 and newer version.
Example
<?php $host = gethostbyaddr("52.25.109.230"); echo $host; ?> |
chevron_right
filter_none
Output:
ec2-52-25-109-230.us-west-2.compute.amazonaws.com
Reference: https://www.php.net/manual/en/function.gethostbyaddr.php
Recommended Posts:
- How to call a function that return another function in JavaScript ?
- How to get the function name from within that function using JavaScript ?
- How to get the function name inside a function in PHP ?
- PHP | Ds\Map get() Function
- PHP | min( ) Function
- p5.js | box() Function
- D3.js | d3.map.set() Function
- PHP | max( ) Function
- CSS | rgb() Function
- p5.js | str() function
- p5.js | int() function
- PHP | dir() Function
- D3.js | d3.hcl() Function
- D3.js | d3.lab() Function
- p5.js | value() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



