PHP | inet_pton() Function Last Updated : 05 Sep, 2019 Comments Improve Suggest changes Like Article Like Report The inet_pton() function is an inbuilt function in PHP which converts a readable format IP address into a packed 32bit IPv4 or 128bit IPv6 address. Syntax: string inet_pton( string $ip_address ) Parameters: This function accepts single parameter as mentioned above and described below: $ip_address: It is required parameter. It specifies the readable IP address. Return Value: This function returns a packed 32bit IPv4 or 128bit IPv6 address on success and FALSE on failure. Note: This function is available for PHP 5.1.0 and newer version. Output of the following examples may differ in this page and actual output. So please see output screenshots. Below programs illustrate the inet_pton() function in PHP: Program 1: php <?php // Use inet_pton() function on IP // address and get result $addr = inet_pton("127.0.1.1"); echo $addr; ?> Output: Program 2: php <?php echo inet_pton("".gethostbyname("www.google.com"))."<br>"; echo inet_pton("".gethostbyname("www.youtube.com"))."<br>"; echo inet_pton("".gethostbyname("www.facebook.com"))."<br>"; echo inet_pton("".gethostbyname("www.geeksforgeeks.org"))."<br>"; echo inet_pton("".gethostbyname("php.net"))."<br>"; ?> Output: Reference: https://www.php.net/manual/en/function.inet-pton.php Comment More infoAdvertise with us Next Article PHP | inet_pton() Function G gekcho Follow Improve Article Tags : Web Technologies PHP PHP-function Similar Reads PHP isset() Function The isset() function in PHP checks whether a variable is declared and not NULL. It returns true if the variable exists and has a non-NULL value, and false otherwise, without modifying the variable. Syntaxbool isset( mixed $var [, mixed $... ] )Parameters: This function accept one or more parameter a 3 min read PHP | popen( ) Function The popen() function used to open a pipe to the program specified by the user using the command parameter. It returns a file pointer which is identical to that returned by fopen(), but it is unidirectional in nature i.e it can be only used for reading or writing. The popen() pointer can be used with 2 min read PHP | random_int() Function The random_int () is an inbuilt function in PHP. The main function is to generate cryptographically secure pseudo-random integers value. When unbiased results occur in critical condition, then generated cryptographic random integers are used.The different sources of randomness used in this function 2 min read PHP pos() Function The pos() is an inbuilt function in PHP which is used to return the value of the element in an array which the internal pointer is currently pointing to. The pos() function does not increment or decrement the internal pointer after returning the value. In PHP all arrays have an internal pointer. Thi 2 min read PHP | inet_ntop() Function The inet_ntop() function is an inbuilt function in PHP which converts a 32bit IPv4 or 128bit IPv6 address into a readable format. Syntax: string inet_ntop( string $ip_address ) Parameter: This function accepts one parameter as mentioned above and described below: $ip_address: It is required paramete 1 min read Like