private static function _iniValue($key, $value)
    {
        if (is_array($value)) {
            $res = '';
            foreach ($value as $v) {
                $res .= self::_iniValue($key.'[]', $v);
            }

            return $res;
        } elseif ($value == ''
                  || is_numeric($value)
                  || (is_string($value) &&
                      preg_match("/^[\w\\-\\.]*$/", $value) &&
                      strpos("\n", $value) === false)
        ) {
            return $key.'='.$value."\n";
        } elseif ($value === false) {
            return $key."=off\n";
        } elseif ($value === true) {
            return $key."=on\n";
        } else {
            return $key.'="'.$value."\"\n";
        }
    }