/** * Check if the message CRC is ok * @return void */ private function performChecksum() { $ct = AdsbUtils::getChecksumTable(); $this->_valid = false; $checksum = intval(substr($this->_msg, 22, 6), 16); $crc = 0; for ($i = 0; $i < strlen($this->_bin); $i++) { if ($this->_bin[$i]) { $crc = $crc ^ intval($ct[$i], 0); } } if ($crc == $checksum) { $this->_valid = true; } }