People are talking about characters when one can compress an IP address into raw data.
So in principle, since we only use IPv4 (32bit) or IPv6 (128bit), that means you need at most 128 bits of space, or 128/8 = 16 bytes!
Which is much less than the suggested 39 bytes (assuming charset is ascii).
That said, you will have to decode and encode the IP address into/from the raw data, which in itself is a trivial thing to do (I've done it before, see PHP's ip2long()
for 32-bit IPs).
Edit: inet_pton
(and its opposite, inet_ntop()
) does what you need, and works with both address types. But beware, on Windows it's available since PHP 5.3.