Change language

PHP Inet_pton () Function

Syntax:
string inet_pton (string $ip_address)
Parameters:This function takes one parameter as above and described below:
  • $ip_address:Required. Specifies a readable IP address.
Return Value:This function returns a packed 32-bit IPv4 or 128-bit IPv6 address on success and FALSE on failure .Notes :
  • This function is available for PHP 5.1.0 and above.
  • Output of the following examples the actual output may differ on this page. So please see the output screenshots.
The following programs illustrate the inet_pton() function in PHP:Program 1:  
// Use the inet_pton() function for IP
// address and get the result $addr = inet_pton ( "127.0.1.1" ); echo $addr ;  
?>
Output: Program 2: echo inet_pton ( "" . gethostbyname ( "www.google.com" ) ). "
"
; echo inet_pton ( "" . gethostbyname ( " www.youtube.com " )). "
"
; echo inet_pton ( "" . gethostbyname ( " www.facebook.com " )). "
"
; echo inet_pton ( "" . gethostbyname ( " www.engineerforengineer.org " )). "
"
; echo inet_pton ( "" . gethostbyname ( " php.net " )). "
"
;  
?>
Output: Link: https://www.php.net/manual/en/function.inet-pton.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