public static function parseLabels(&$data, $orig = null)
    {
        $str = '';
        while (strlen($data) > 0)
        {
            $l = ord($data[0]);

            if ($l >= 192) {
                $pos  = static::bytes2int(chr($l - 192) . static::binarySubstr($data, 1, 1));
                $data = static::binarySubstr($data, 2);
                $ref  = static::binarySubstr($orig, $pos);

                return $str . static::parseLabels($ref);
            }

            $p = substr($data, 1, $l);
            $str .= $p . (($l !== 0) ? '.' : '');
            $data = substr($data, $l + 1);
            if ($l === 0) {
                break;
            }
        }
        return $str;
    }
public static function parseLabels(&$data, $orig = null)
    {
        $str = '';
        while (strlen($data) > 0)
        {
            $l = ord($data[0]);

            if ($l >= 192) {
                $pos  = static::bytes2int(chr($l - 192) . static::binarySubstr($data, 1, 1));
                $data = static::binarySubstr($data, 2);
                $ref  = static::binarySubstr($orig, $pos);

                return $str . static::parseLabels($ref);
            }

            $p = substr($data, 1, $l);
            $str .= $p . (($l !== 0) ? '.' : '');
            $data = substr($data, $l + 1);
            if ($l === 0) {
                break;
            }
        }
        return $str;
    }
public static function parseLabels ( & $ data , $ orig = null ) { $ str = '' ; while ( strlen ( $ data ) > 0 ) { $ l = ord ( $ data [ 0 ] ) ; if ( $ l >= 192 ) { $ pos = static :: bytes2int ( chr ( $ l - 192 ) . static :: binarySubstr ( $ data , 1 , 1 ) ) ; $ data = static :: binarySubstr ( $ data , 2 ) ; $ ref = static :: binarySubstr ( $ orig , $ pos ) ; return $ str . static :: parseLabels ( $ ref ) ; } $ p = substr ( $ data , 1 , $ l ) ; $ str .= $ p . ( ( $ l !== 0 ) ? '.' : '' ) ; $ data = substr ( $ data , $ l + 1 ) ; if ( $ l === 0 ) { break ; } } return $ str ; }
Parse structure of labels.

@param string $data
@param string $orig
@return string Dot-separated labels list.
Parse structure of labels .