And this is the opposite, based on the large Alnitak code, as a function:
function ptr_to_ipv6($arpa) { $mainptr = substr($arpa, 0, strlen($arpa)-9); $pieces = array_reverse(explode(".",$mainptr)); $hex = implode("",$pieces); $ipbin = pack('H*', $hex); $ipv6addr = inet_ntop($ipbin); return $ipv6addr; }
source share