private function _queryArrayByKey($key, $value, array $array = array())
    {
        if (!strlen($key)) {
            return $array;
        }

        $offset = $this->_queryKeyBracketOffset($key);
        if ($offset === false) {
            $name = $key;
        } else {
            $name = substr($key, 0, $offset);
        }

        if (!strlen($name)) {
            return $array;
        }

        if (!$offset) {
            // named value
            $array[$name] = $value;
        } else {
            // array
            $brackets = substr($key, $offset);
            if (!isset($array[$name])) {
                $array[$name] = null;
            }
            $array[$name] = $this->_queryArrayByBrackets(
                $brackets, $value, $array[$name]
            );
        }

        return $array;
    }
private function _queryArrayByKey($key, $value, array $array = array())
    {
        if (!strlen($key)) {
            return $array;
        }

        $offset = $this->_queryKeyBracketOffset($key);
        if ($offset === false) {
            $name = $key;
        } else {
            $name = substr($key, 0, $offset);
        }

        if (!strlen($name)) {
            return $array;
        }

        if (!$offset) {
            // named value
            $array[$name] = $value;
        } else {
            // array
            $brackets = substr($key, $offset);
            if (!isset($array[$name])) {
                $array[$name] = null;
            }
            $array[$name] = $this->_queryArrayByBrackets(
                $brackets, $value, $array[$name]
            );
        }

        return $array;
    }
private function _queryArrayByKey ( $ key , $ value , array $ array = array ( ) ) { if ( ! strlen ( $ key ) ) { return $ array ; } $ offset = $ this -> _queryKeyBracketOffset ( $ key ) ; if ( $ offset === false ) { $ name = $ key ; } else { $ name = substr ( $ key , 0 , $ offset ) ; } if ( ! strlen ( $ name ) ) { return $ array ; } if ( ! $ offset ) { // named value $ array [ $ name ] = $ value ; } else { // array $ brackets = substr ( $ key , $ offset ) ; if ( ! isset ( $ array [ $ name ] ) ) { $ array [ $ name ] = null ; } $ array [ $ name ] = $ this -> _queryArrayByBrackets ( $ brackets , $ value , $ array [ $ name ] ) ; } return $ array ; }
Parse a single query key=value pair into an existing php array

@param string $key   query-key
@param string $value query-value
@param array  $array of existing query variables (if any)

@return mixed
Parse a single query key = value pair into an existing php array