src/HSPHP/ReadSocket.php
public function getIndexId($db, $table, $key, $fields)
    {
        if (is_array($fields)) {
            $fields = implode(',', $fields);
        }

        if (isset($this->indexes[$db][$table][$key][$fields])) {
            return $this->indexes[$db][$table][$key][$fields];
        } else {
            //register new index ,save it and return
            $this->openIndex($this->currentIndex, $db, $table, $key, $fields);
            $ret = $this->readResponse();
            if (!$ret instanceof ErrorMessage) {
                $this->indexes[$db][$table][$key][$fields] = $this->currentIndex++;
                return $this->currentIndex - 1;
            } else {
                throw $ret;
            }
        }
    }
public function getIndexId($db, $table, $key, $fields)
    {
        if (is_array($fields)) {
            $fields = implode(',', $fields);
        }

        if (isset($this->indexes[$db][$table][$key][$fields])) {
            return $this->indexes[$db][$table][$key][$fields];
        } else {
            //register new index ,save it and return
            $this->openIndex($this->currentIndex, $db, $table, $key, $fields);
            $ret = $this->readResponse();
            if (!$ret instanceof ErrorMessage) {
                $this->indexes[$db][$table][$key][$fields] = $this->currentIndex++;
                return $this->currentIndex - 1;
            } else {
                throw $ret;
            }
        }
    }
{@inheritdoc}