True/False Config

Discussion in 'Development' started by xanb, Jul 20, 2021.

  1. xanb

    xanb Spider

    Messages:
    6
    How could I set a true/false config?
     
  2. UPL

    UPL Silverfish

    Messages:
    15
    Hi! I tried that too, but we can't make true or false config. You can use 0 and 1! (0 = false and 1 = true) Thanks!
     
  3. Primus

    Primus Zombie Pigman

    Messages:
    693
  4. xanb

    xanb Spider

    Messages:
    6
    How could you write that?

    Just

    PHP:
    $this->getConfig->get("config-name");
    true;
    false;
    ?
     
    Last edited: Jul 21, 2021
  5. minijaham

    minijaham Zombie Pigman

    Messages:
    693
    GitHub:
    minijaham
    Wouldn't setting that in the config return an int? :flushed:
    PHP:
    $this->getConfig->setNested($value0); // Int

    $this->getConfig->setNested($valuetrue); // boolean
     
    ErikX likes this.
  6. PiloudeDakar

    PiloudeDakar Witch

    Messages:
    54
    GitHub:
    PiloudeDakar
    When you introduce it in comparator ==, if it 0 : considering false and 1 : considering true

    Exemple :
    PHP:
    if($config->get(0)) //Not executing
    if($config(1)) //Executing
     
  7. xLeakDev Enzo

    xLeakDev Enzo Spider Jockey

    Messages:
    38
    GitHub:
    nya-enzo
    You could just set your value to true or false, and when getting it do
    $value = (bool)$myConfig->get("MyValue");
     

Share This Page

  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.