public function setValue($name, $value, $section = 0, $key = null)
    {
        $foundValue = false;
        $lastKey = -1; // last key in an array value
        if (isset($this->content[$section])) {
            // boolean to erase array values if the new value is not a new item for the array
            $deleteMode = false;
            foreach ($this->content[$section] as $k => $item) {
                if ($deleteMode) {
                    if ($item[0] == self::TK_ARR_VALUE && $item[1] == $name) {
                        $this->content[$section][$k] = array(self::TK_WS, '--');
                    }
                    continue;
                }

                // if the item is not a value or an array value, or not the same name
                if (($item[0] != self::TK_VALUE && $item[0] != self::TK_ARR_VALUE)
                    || $item[1] != $name) {
                    continue;
                }

                // if it is an array value, and if the key doesn't correspond
                if ($item[0] == self::TK_ARR_VALUE && $key !== null) {
                    if ($item[3] != $key || $key === '') {
                        $lastKey = $item[3];
                        continue;
                    }
                }
                if ($key !== null) {
                    // we add the value as an array value
                    if ($key === '') {
                        $key = 0;
                    }
                    $this->content[$section][$k] = array(self::TK_ARR_VALUE, $name,$value, $key);
                } else {
                    // we store the value
                    $this->content[$section][$k] = array(self::TK_VALUE, $name, $value);
                    if ($item[0] == self::TK_ARR_VALUE) {
                        // the previous value was an array value, so we erase other array values
                        $deleteMode = true;
                        $foundValue = true;
                        continue;
                    }
                }
                $foundValue = true;
                break;
            }
        } else {
            $this->content[$section] = array(array(self::TK_SECTION, '['.$section.']'));
        }
        if (!$foundValue) {
            if ($key === null) {
                $this->content[$section][] = array(self::TK_VALUE, $name, $value);
            } else {
                if ($lastKey != -1) {
                    ++$lastKey;
                } else {
                    $lastKey = 0;
                }
                $this->content[$section][] = array(self::TK_ARR_VALUE, $name, $value, $lastKey);
            }
        }

        $this->modified = true;
    }