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 long2ip() Function.
The built-in PHP long2ip() function is used in converting long integer value into an IPv4 address.
The built-in PHP long2ip() function is used in converting long integer value into an IPv4 address.
Syntax
Following below is the syntax to use this function -
string long2ip ( string $proper_address )
Parameter Details
Sr.No | Parameters & Description |
---|---|
1 | proper_address It contains Long integer value. |
Return Value
This built-in function returns an internet IP address as a string on success, else false on failure.
Example
Try out the following example below -
<?php $ip = "49.204.34.96"; $s32int = ip2long($ip); $us32str = sprintf("%u",$s32int); printf("%s %s",$us32str,long2ip(-(4294967296-$us32str))); ?>
Output
When the above code is executed, it will produce the following result below -
835461728 49.204.34.96
READ: PHP | ip2long() Function
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 openlog() 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.