Skip to content
Snippets Groups Projects
Commit 2c51e2e0 authored by Tim Steiner's avatar Tim Steiner
Browse files

More case sensitivity crap

parent 2fa4a2c0
No related branches found
No related tags found
No related merge requests found
<?php
class Nmc_IpAddress
{
static public function binaryToString($hexIP)
{
$address = array();
for($i = 0; $i < 4; $i++) {
$address[] = hexdec(bin2hex($hexIP[$i]));
}
$address = implode('.', $address);
return $address;
}
static public function intToString($intIP)
{
$address = array();
for($i = 3; $i >= 0; $i--) {
$address[] = ($intIP >> ($i * 8)) & 0x000000FF;
}
$address = implode('.', $address);
return $address;
}
static public function stringToInt($stringIP)
{
$stringIP = explode('.', $stringIP);
$address = 0
+ (intval($stringIP[0]) << 24)
+ (intval($stringIP[1]) << 16)
+ (intval($stringIP[2]) << 8)
+ (intval($stringIP[3]) << 0);
return $address;
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment