PHP | long2ip() Function Last Updated : 05 Sep, 2019 Comments Improve Suggest changes Like Article Like Report The long2ip() function is an inbuilt function in PHP which converts long integer into corresponding IPv4 address in string format. Syntax: string long2ip( int $ip_in_long ) Parameters: This function accepts single parameter as mentioned above and described below: $ip_in_long: It is required parameter. It specifies a long integer that represents an IP address. Return Value: This function returns an IP address in string format. Note: This function is available on PHP 4.0.0 and newer versions. Below programs illustrate the long2ip() function in PHP: Program 1: php <?php // Use long2ip() function to converts // long integer address into a string // format echo(long2ip(344294967296)); ?> Output: 41.148.72.0 Program 2: php <?php // Store the long integer address in an array $hosts = array( 874081766, 3627733732, 3627734286, 520968740, 2539994370, 2539979077); $out = "List of IP addresses:"; foreach( $hosts as $host ) { $ip = long2ip($host); $hostname = gethostbyaddr($ip); $out .= "<br> https://" . $host . "/ https://" . $ip . "/ https://" . $hostname . "/"; } echo $out; ?> Output: List of IP addresses: https://874081766/ https://52.25.109.230/ https://ec2-52-25-109-230.us-west-2.compute.amazonaws.com/ https://3627733732/ https://216.58.210.228/ https://mrs04s10-in-f228.1e100.net/ https://3627734286/ https://216.58.213.14/ https://lhr25s25-in-f14.1e100.net/ https://520968740/ https://31.13.90.36/ https://edge-star-mini-shv-01-lhr3.facebook.com/ https://2539994370/ https://151.101.61.2/ https://151.101.61.2/ https://2539979077/ https://151.101.1.69/ https://151.101.1.69/ Reference: https://www.php.net/manual/en/function.long2ip.php Comment More infoAdvertise with us Next Article PHP | long2ip() Function G gekcho Follow Improve Article Tags : Web Technologies PHP PHP-function Similar Reads PHP log1p() Function The log1p() is an inbuilt PHP function that returns log(1+number), & when the value of the number is close to zero, then it will compute the way that will provide the accurate result. Syntax: log1p(float $num): floatParameter: This function accepts only a single parameter: num: This parameter sp 1 min read PHP | ip2long() Function The ip2long() function is an inbuilt function in PHP that converts IPv4 address (dotted IP address) into a long integer. Syntax:Â int ip2long( string $ip_address ) Parameters: This function accepts single parameter as mentioned above and described below:Â Â $ip_address: It is required parameter which 2 min read PHP is_long() Function The is_long() function is an inbuilt function in PHP that is used to check whether the given value is a long integer or not. Syntax: bool is_long(mixed $value) Parameters: This function accepts a single parameter $value that holds the value which needs to check for a long integer. Return Value: This 1 min read PHP | gmp_or() Function The gmp_or() is an inbuilt function in PHP which is used to calculate the bitwise OR of two GMP numbers(GNU Multiple Precision : For large numbers). Syntax: gmp_or($num1, $num2) Parameters: This function accepts two GMP numbers, $num1, $num2 as mandatory parameters as shown in the above syntax. Thes 2 min read PHP | pack() Function The pack() function is an inbuilt function in PHP which is used to pack the given parameter into a binary string in a given format. Syntax: pack( $format, $arguments ) Parameters: This function accepts two parameters as mentioned above and described below: $format: It is required parameter. It speci 2 min read PHP | imageflip() Function The imageflip() function is an inbuilt function in PHP which is used to Flip an image horizontally, vertically or both horizontally and vertically using the given mode. Syntax: bool imageflip( $image, $mode ) Parameters: This function accepts two parameters as mentioned above and described below: $i 2 min read PHP | gmp_and() Function The gmp_and() is an inbuilt function in PHP which is used to calculate the bitwise AND of two GMP numbers(GNU Multiple Precision : For large numbers). Syntax: gmp_and($num1, $num2) Parameters: This function accepts two GMP numbers, $num1, $num2 as mandatory parameters as shown in the above syntax. T 2 min read PHP | gmp_com() Function The gmp_com() is an inbuilt function in PHP which is used to calculate the one's complement of a GMP number(GNU Multiple Precision : For large numbers). Syntax: gmp_com($num) Parameters: This function accepts a GMP number $num as a mandatory parameter as shown in the above syntax. This parameter can 2 min read PHP | gmp_mul() Function The gmp_mul() function in PHP is an inbuilt function which is used to multiply two GMP numbers (GNU Multiple Precision: For large numbers). Syntax: GMP gmp_mul ( GMP $num1, GMP $num2 ) Parameters: This function accepts two GMP numbers. It is mandatory parameters as shown in the above syntax. These c 1 min read PHP | gmp_cmp() Function The gmp_cmp() is an inbuilt function in PHP which is used to compare two GMP numbers(GNU Multiple Precision : For large numbers). Syntax: gmp_cmp($num1, $num2) Parameters: This function accepts two GMP numbers $num1 and $num2 as mandatory parameters as shown in the above syntax for comparing. These 2 min read Like