long2ip()
long2ip() — Converts a long integer address into a string in (IPv4) Internet standard dotted format.
Built-in function of PHP 8.5. The manual lists it as available in PHP 4, PHP 5, PHP 7, PHP 8. This page is the reference card: signature, parameters and return value, plus the changelog and the example the manual provides.
What it does
The function long2ip() generates an Internet address in dotted format (i.e.: aaa.bbb.ccc.ddd) from the long integer representation.
Signature
long2ip(int $ip): string
Parameters
| Parameter | Type | What it takes |
|---|---|---|
| $ip | int | A proper address representation in long integer. |
Return value
Returns the Internet IP address as a string.
Example
The PHP manual ships no example for long2ip(); the signature and the parameter table above are the contract.
Changelog
| Version | Change |
|---|---|
| 8.4.0 | Return type changed from string|false to string. |
| 7.1.0 | The parameter type of ip has been changed from string to int. |
See also
All PHP 8.5 built-in functions
Reference card built from the PHP manual page long2ip() (PHP documentation, CC BY 3.0). The page is generated from the manual, so the wording of the parameter and return value text follows php.net.