• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

PHP to convert IPv4 to Xenforo storable format

#1
Hello!

I am able to pull IP's out of the Xenforo database using
$iparray[] = long2ip(hexdec(bin2hex($row['ip'])));

I want to be able to store IP addresses using my API, this uses PHP and MYSQL queries.

How can I do the reverse of above to convert the IP to the correct format to store?

ip2long($ip) is incorrect and needs something further.