mysql - PHP inet_pton returning empty string... var_dump says otherwise -


i trying save ipv6 address in mysql database. using inet_pton this. however, have noticed ip's (in particular localhost ip) returning empty strings. example:

$ip = inet_pton('::1'); 

and if var_dump of $ip shows it's length 16, nothing being returned:

var_dump($ip); // string(16) "" 

what happening here?

ipv6 addresses 128bit, 16 bytes/chars. ::1 corresponds 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:01, you're printing 15 null bytes , 0x01, not printable character.


Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

c++ - Correct method for redrawing a layered window -

java.util.scanner - How to read and add only numbers to array from a text file -