Change language

PHP Long2ip () Function

Syntax:
string long2ip (int $ip_in_long)
Parameters:This function takes one parameter as above and described below:
  • $ip_in_long:Required. It defines a long integer that represents the IP address.
Return Value:This function returns the IP address in string format.Note.This function is available in PHP 4.0.0 and later.The following programs illustrate the long2ip() function in PHP:Program 1: < tbody>  
// Use the long2ip() function to convert
// long integer address into a string
// format echo (long2ip ( 344294967296)); ?>
Output:
41.148.72.0
Program 2:  
// 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 . = "
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/
Link: https://www.php.net/manual/en/function.long2ip.php

Shop

Best laptop for Sims 4

$

Best laptop for Zoom

$499

Best laptop for Minecraft

$590

Best laptop for engineering student

$

Best laptop for development

$

Best laptop for Cricut Maker

$

Best laptop for hacking

$890

Best laptop for Machine Learning

$950

Latest questions

NUMPYNUMPY

psycopg2: insert multiple rows with one query

12 answers

NUMPYNUMPY

How to convert Nonetype to int or string?

12 answers

NUMPYNUMPY

How to specify multiple return types using type-hints

12 answers

NUMPYNUMPY

Javascript Error: IPython is not defined in JupyterLab

12 answers

Wiki

Python OpenCV | cv2.putText () method

numpy.arctan2 () in Python

Python | os.path.realpath () method

Python OpenCV | cv2.circle () method

Python OpenCV cv2.cvtColor () method

Python - Move item to the end of the list

time.perf_counter () function in Python

Check if one list is a subset of another in Python

Python os.path.join () method