PHP functions for IPv4/v6