本文整理汇总了PHP中IP::hexToOctet方法的典型用法代码示例。如果您正苦于以下问题:PHP IP::hexToOctet方法的具体用法?PHP IP::hexToOctet怎么用?PHP IP::hexToOctet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IP
的用法示例。
在下文中一共展示了IP::hexToOctet方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testHexToOctet
/**
* @covers IP::hexToOctet
*/
public function testHexToOctet()
{
$this->assertEquals('0:0:0:0:0:0:0:1', IP::hexToOctet('00000000000000000000000000000001'));
$this->assertEquals('0:0:0:0:0:0:FF:3', IP::hexToOctet('00000000000000000000000000FF0003'));
$this->assertEquals('0:0:0:0:0:0:FF00:6', IP::hexToOctet('000000000000000000000000FF000006'));
$this->assertEquals('0:0:0:0:0:0:FCCF:FAFF', IP::hexToOctet('000000000000000000000000FCCFFAFF'));
$this->assertEquals('FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF', IP::hexToOctet('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF'));
// hex not left-padded...
$this->assertEquals('0:0:0:0:0:0:0:0', IP::hexToOctet('0'));
$this->assertEquals('0:0:0:0:0:0:0:1', IP::hexToOctet('1'));
$this->assertEquals('0:0:0:0:0:0:0:FF', IP::hexToOctet('FF'));
$this->assertEquals('0:0:0:0:0:0:0:FFD0', IP::hexToOctet('FFD0'));
$this->assertEquals('0:0:0:0:0:0:FA00:0', IP::hexToOctet('FA000000'));
$this->assertEquals('0:0:0:0:0:0:FCCF:FAFF', IP::hexToOctet('FCCFFAFF'));
}
示例2: testHexToOctet
/**
* @covers IP::hexToOctet
* @dataProvider provideOctetsAndHexes
*/
public function testHexToOctet($octet, $hex)
{
$this->assertEquals($octet, IP::hexToOctet($hex));
}