Hello folks! welcome back to a new edition of our tutorial on PHP. In this tutorial guide, we are going to be studying about the PHP inet_pton() Function.
The built-in inet_pton() function is used to convert human readable Ip address into an in_addr format.
The built-in inet_pton() function is used to convert human readable Ip address into an in_addr format.
Syntax
Following below is the syntax to use this function -
string inet_pton ( string $address )
Parameter Details
Sr.No | Parameters & Description |
---|---|
1 | address it contains IPv4, or IPv6 address. |
Return Value
This function returns an in_addr address on success, else it shows a failure message.
Example
Try out the following example below -
<?php $in_addr = inet_pton('127.0.0.1'); ?>
Output
The following code above reconverts the IP address into an in_addr format address.
Alright guys! This is where we are going to be rounding up for this tutorial post. In our next tutorial, we are going to be discussing about the PHP ip2long() Function.
Do feel free to ask your questions where necessary and we will attend to them as soon as possible. If this tutorial was helpful to you, you can use the share button to share this tutorial.
Do follow us on our various social media handles available and also subscribe to our newsletter to get our tutorial posts delivered directly to your emails.
Thanks for reading and bye for now.
Do feel free to ask your questions where necessary and we will attend to them as soon as possible. If this tutorial was helpful to you, you can use the share button to share this tutorial.
Do follow us on our various social media handles available and also subscribe to our newsletter to get our tutorial posts delivered directly to your emails.
Thanks for reading and bye for now.