Добро пожаловать на форум PHP программистов!
За последние 24 часа нас посетили 18867 программистов и 1635 роботов. Сейчас ищет 2031 программист ...

Net_IPv6::compress()

Вернуться к: Net_IPv6

Net_IPv6::compress()

Net_IPv6::compress() – compress an IPv6 address

Synopsis

require_once 'Net/IPv6.php';

string Net_IPv6::compress ( string $ip , boolean $force = false )

Compresses an IPv6 address. RFC 2373 allows you to compress zeros in an address to '::'. This function expects an valid IPv6 address and compresses successive zeros to '::'

FF01:0:0:0:0:0:0:101 -> FF01::101       0:0:0:0:0:0:0:1      -> ::1

By default, the method does not touch an already compressed address and returns the address as is. This happens also in case of an address that is compressed but can be compressed further, for example an address like FF01::0:1 will be returned as is.

Since version 1.2.1, you can change this behavoir to enforce compression by setting $force to true.

Parameter

  • string $ip - the IP address to compress

  • boolean $force - if true, an already compressed IP address will be compressed again

Return value

string - the compressed IP is an IPv6 address

Note

This function can be called statically.



Вернуться к: Net_IPv6

© 2025 «PHP.RU — Сообщество PHP-Программистов»
Главная | Форум | Реклама на сайте | Контакты VIP Сувениры
Разработка компании ODware