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";
        }
    }
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";
        }
    }
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" ; } }
format a value to store in a ini file.

@param string $value the value

@return string the formated value
format a value to store in a ini file .