public function union(Basic $hll) { $registers = $hll->getRegisters(); // The set to be unioned may be bigger than this initial set so we need to increase this set to match if (count($this->registers) < ($newCount = count($registers))) { $this->resize($newCount); } for ($i = 0; $i < count($registers); $i++) { if (!isset($this->registers[$i]) || $this->registers[$i] < $registers[$i]) { $this->registers[$i] = $registers[$i]; } } }