lib/IniModifier.php
public function removeValue($name, $section = 0, $key = null, $removePreviousComment = true)
    {
        if ($section === 0 && $name == '') {
            return;
        }

        if ($name == '') {
            $this->removeSection($section, $removePreviousComment);
            return;
        }

        if (isset($this->content[$section])) {
            // boolean to erase array values if the option to remove is an array
            $deleteMode = false;
            $previousComment = array();
            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 ($item[0] == self::TK_COMMENT) {
                    if ($removePreviousComment) {
                        $previousComment[] = $k;
                    }
                    continue;
                }

                if ($item[0] == self::TK_WS) {
                    if ($removePreviousComment) {
                        $previousComment[] = $k;
                    }
                    continue;
                }

                // if the item is not a value or an array value, or not the same name
                if ($item[1] != $name) {
                    $previousComment = array();
                    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) {
                        $previousComment = array();
                        continue;
                    }
                }
                $this->modified = true;
                if (count($previousComment)) {
                    $kc = array_pop($previousComment);
                    while ($kc !== null && $this->content[$section][$kc][0] == self::TK_WS) {
                        $kc = array_pop($previousComment);
                    }

                    while ($kc !== null && $this->content[$section][$kc][0] == self::TK_COMMENT) {
                        if (strpos($this->content[$section][$kc][1], '<?') === false) {
                            $this->content[$section][$kc] = array(self::TK_WS, '--');
                        }
                        $kc = array_pop($previousComment);
                    }
                }
                if ($key !== null) {
                    // we remove the value from the array
                    $this->content[$section][$k] = array(self::TK_WS, '--');
                } else {
                    // we remove the value
                    $this->content[$section][$k] = array(self::TK_WS, '--');
                    if ($item[0] == self::TK_ARR_VALUE) {
                        // the previous value was an array value, so we erase other array values
                        $deleteMode = true;
                        continue;
                    }
                }
                break;
            }
        }
    }
public function removeValue($name, $section = 0, $key = null, $removePreviousComment = true)
    {
        if ($section === 0 && $name == '') {
            return;
        }

        if ($name == '') {
            $this->removeSection($section, $removePreviousComment);
            return;
        }

        if (isset($this->content[$section])) {
            // boolean to erase array values if the option to remove is an array
            $deleteMode = false;
            $previousComment = array();
            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 ($item[0] == self::TK_COMMENT) {
                    if ($removePreviousComment) {
                        $previousComment[] = $k;
                    }
                    continue;
                }

                if ($item[0] == self::TK_WS) {
                    if ($removePreviousComment) {
                        $previousComment[] = $k;
                    }
                    continue;
                }

                // if the item is not a value or an array value, or not the same name
                if ($item[1] != $name) {
                    $previousComment = array();
                    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) {
                        $previousComment = array();
                        continue;
                    }
                }
                $this->modified = true;
                if (count($previousComment)) {
                    $kc = array_pop($previousComment);
                    while ($kc !== null && $this->content[$section][$kc][0] == self::TK_WS) {
                        $kc = array_pop($previousComment);
                    }

                    while ($kc !== null && $this->content[$section][$kc][0] == self::TK_COMMENT) {
                        if (strpos($this->content[$section][$kc][1], '<?') === false) {
                            $this->content[$section][$kc] = array(self::TK_WS, '--');
                        }
                        $kc = array_pop($previousComment);
                    }
                }
                if ($key !== null) {
                    // we remove the value from the array
                    $this->content[$section][$k] = array(self::TK_WS, '--');
                } else {
                    // we remove the value
                    $this->content[$section][$k] = array(self::TK_WS, '--');
                    if ($item[0] == self::TK_ARR_VALUE) {
                        // the previous value was an array value, so we erase other array values
                        $deleteMode = true;
                        continue;
                    }
                }
                break;
            }
        }
    }
remove an option from the ini file.

It can remove an entire section if you give an empty value as $name,
and a $section name. (deprecated behavior, see removeSection())

@param string $name    the name of the option to remove, or null to remove an entire section
@param string $section the section where to remove the value, or the section to remove
@param int    $key     for option which is an item of array, the key in the array

@since 1.2