1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Change something in a Config

Discussion in 'Development' started by bySentixPE, May 10, 2019.

  1. bySentixPE

    bySentixPE Spider Jockey

    Messages:
    37
    Hello Pocketmine-Developer,
    I need to know how can i change somethink in a Config if the "somethink" already exist?

    $config->set($config->get("Rang: ", "Owner");
    ^^
    Do not work.
     
  2. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    Any error
     
  3. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    Try $config->set("Rank", "Owner");
     
  4. bySentixPE

    bySentixPE Spider Jockey

    Messages:
    37
    Nah, this can't work bc it set a new value into the Config.
     
  5. bySentixPE

    bySentixPE Spider Jockey

    Messages:
    37
    Nah
     
  6. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    Isnt That what you want
     
  7. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    Did you try it? As far as i know it updates the key value
     
  8. KielKing

    KielKing Zombie

    Messages:
    245
    GitHub:
    kielking
    PHP:
    $arr $config->getAll();
    if(isset(
    $arr["your_index"])){
        
    $arr["your_index"] = "New Value";
    }
    $config->setAll($arr);
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.