Quick way of expanding IPv6 Addresses with PHP
问题 I was working on a project where I needed to expand IPv6 addresses. There are not many functions out there created by other users, and the ones that exist are ugly. Some of them included multiple foreach 's and gmp_init , which added a lot of overhead and harder to maintain code. I need a simple, non-taxing script to expand IPv6. Posting this for the community. 回答1: The following is a two liner, where $ip is a condensed IPv6 address. Returns expanded $ip . Example : $ip = "fe80:01::af0"; echo