The following describes the restrictions on the field values for the inet_addr subroutine:
Format Field Restrictions (in decimal)
a Value_a < 4,294,967,296
a.b Value_a < 256; Value_b < 16,777,216
a.b.c Value_a < 256; Value_b < 256; Value_c < 65536
a.b.c.d Value_a < 256; Value_b < 256; Value_c < 256; Value_d < 256
Т.е. 62.149.62 мы понимаем как 62.149.aa.bb, где aa.bb равно 62, т.е. 00.62. DileSoftправ :)
Note: Because PHP's integer type is signed, and many IP addresses will result in negative integers, you need to use the "%u" formatter of sprintf() or printf() to get the string representation of the unsigned IP address.
Вы написали для случая 62.149.0.62. У меня записано то же самое. А вот для 62.149.62 я действительно ошибся. ТО, что записано у меня во второй строке — это для 62.149.62.0
А для 62.149.62 будет: 62 * 2562 + 149 * 2561 + 62 * 256o = 4101438. Т.е. вс равно не равно :-)
publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/libs/commtrf2/inet_addr.htm
Т.е. 62.149.62 мы понимаем как 62.149.aa.bb, где aa.bb равно 62, т.е. 00.62.
DileSoftправ :)
Note: Because PHP's integer type is signed, and many IP addresses will result in negative integers, you need to use the "%u" formatter of sprintf() or printf() to get the string representation of the unsigned IP address.
А для 62.149.62 будет: 62 * 2562 + 149 * 2561 + 62 * 256o = 4101438. Т.е. вс равно не равно :-)
62 * 2563 + 149 * 2562 + 0 * 2561 + 62 * 256O = 1049952318
62 * 2563 + 149 * 2562 + 62 * 2561 = 1049968128
php.net/ip2long
php.net/long2ip
Там же, в мануале, ссылка на реализацию этого же в стандартной библиотеке С. Наверное из C оно и попало в ОС, браузеры и т.п.