protected function unformatAddress($address, &$port)
    {
        // [::1]:2 => ::1 2
        // test:2 => test 2
        // ::1 => ::1
        // test => test

        $colon = strrpos($address, ':');

        // there is a colon and this is the only colon or there's a closing IPv6 bracket right before it
        if ($colon !== false && (strpos($address, ':') === $colon || strpos($address, ']') === ($colon - 1))) {
            $port = (int)substr($address, $colon + 1);
            $address = substr($address, 0, $colon);

            // remove IPv6 square brackets
            if (substr($address, 0, 1) === '[') {
                $address = substr($address, 1, -1);
            }
        }
        return $address;
    }
protected function unformatAddress($address, &$port)
    {
        // [::1]:2 => ::1 2
        // test:2 => test 2
        // ::1 => ::1
        // test => test

        $colon = strrpos($address, ':');

        // there is a colon and this is the only colon or there's a closing IPv6 bracket right before it
        if ($colon !== false && (strpos($address, ':') === $colon || strpos($address, ']') === ($colon - 1))) {
            $port = (int)substr($address, $colon + 1);
            $address = substr($address, 0, $colon);

            // remove IPv6 square brackets
            if (substr($address, 0, 1) === '[') {
                $address = substr($address, 1, -1);
            }
        }
        return $address;
    }
protected function unformatAddress ( $ address , & $ port ) { // [::1]:2 => ::1 2 // test:2 => test 2 // ::1 => ::1 // test => test $ colon = strrpos ( $ address , ':' ) ; // there is a colon and this is the only colon or there's a closing IPv6 bracket right before it if ( $ colon !== false && ( strpos ( $ address , ':' ) === $ colon || strpos ( $ address , ']' ) === ( $ colon - 1 ) ) ) { $ port = ( int ) substr ( $ address , $ colon + 1 ) ; $ address = substr ( $ address , 0 , $ colon ) ; // remove IPv6 square brackets if ( substr ( $ address , 0 , 1 ) === '[' ) { $ address = substr ( $ address , 1 , - 1 ) ; } } return $ address ; }
format given address by splitting it into returned address and port set by reference

@param string $address
@param int $port
@return string address with port removed
format given address by splitting it into returned address and port set by reference