getVariableLength() > 0) { $packed = sprintf('%0' . $this->getVariableLength() . 'd', strlen($packed) * 2) . $packed; } return $packed; } public function unpack(&$message) { if ($this->getVariableLength() > 0) { $length = (int)hex2bin(substr($message, 0, $this->getVariableLength() * 2)); } else { $length = $this->getLength(); } $parsed = hex2bin(substr($message, 0, $length * 2)); $message = substr($message, $length * 2); return $parsed; } }