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 PHP | mysqli_ping() Function The mysqli_ping() function is used to ping a server connection. That is it is used to check if a host is reachable on an IP network or not. This function also tries to reconnect if an existing server connection is lost. To use this function, it is mandatory to first set up the connection with the My 2 min read PHP key() Function The key() function is an inbuilt function in PHP which is used to return the index of the element of a given array to which the internal pointer is currently pointing. The current element may be starting or next element which depends on the cursor position. By default cursor position is at zero inde 2 min read PHP mb_strpos() Function The mb_strpos() function is an inbuilt function in PHP that finds the position of string occurrence in the string. Syntax: mb_strpos( $haystack, $needle, $offset, $encoding ): int|falseParameters: This function accepts 4 parameters that are described below: $haystack: This parameter is the main stri 2 min read PHP strlen() Function The strlen() is a built-in function in PHP which returns the length of a given string.It calculates the length of the string including all the whitespaces and special characters. Syntax:strlen($string);Parameters: This parameter represents the string whose length is needed to be returned. Return Val 1 min read PHP | IntlCalendar set() Function The IntlCalendar::set() function is an inbuilt function in PHP which is used to set the time field or several common fields at once. The range of field value depends on the calendar. This function can not be called with exactly four parameters. Syntax: Object oriented style bool IntlCalendar::set( i 2 min read Like