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

Solved Array reading

Discussion in 'Development' started by Qeis2007, Sep 3, 2018.

  1. Qeis2007

    Qeis2007 Witch

    Messages:
    70
    GitHub:
    FrostingBita
    Hey, i want to know how to read an array
    Example:
    I have this on my config.yml file:
    Code:
    person1: [10, 15, 13]
    Question:
    1. I want to get that on my Main.php as array idk how to do it
    2. Can i detect 10 is available or no on Main.php (detecting on array)
    3. How to make array separate one another
    Thats it!
     
  2. xXNiceAssassinlo YT

    xXNiceAssassinlo YT Zombie Pigman

    Messages:
    499
    GitHub:
    xXNiceYT
    I am not sure about my code....

    1.
    PHP:
    $this->cfg $this->getConfig()->getAll();
    2.
    PHP:
    $get10 $this->cfg["person1"][10];
    3.
    PHP:
    $setcfg this->cfg->set(["hi"]["first"], 1);
     
  3. Eren5960

    Eren5960 Spider Jockey

    Messages:
    27
    GitHub:
    Eren5960
    Not, this
    PHP:
    $get10 $this->cfg["person1"][0];
     
  4. azk_

    azk_ Spider Jockey

    Messages:
    49
    Like this maybe? ;
    PHP:
    $person $this->cfg->get("person1");

    if(
    in_array(10$person)){
    #do stuff
    }
     
    Qeis2007 likes this.
  5. azk_

    azk_ Spider Jockey

    Messages:
    49
    he said "(detecting on array)"
     
  6. Eren5960

    Eren5960 Spider Jockey

    Messages:
    27
    GitHub:
    Eren5960
    Yep, its will works
     
  7. Eren5960

    Eren5960 Spider Jockey

    Messages:
    27
    GitHub:
    Eren5960
    Oh, sorry. I didn't see
     
  8. Eren5960

    Eren5960 Spider Jockey

    Messages:
    27
    GitHub:
    Eren5960
    Qeis2007 likes this.
  9. Qeis2007

    Qeis2007 Witch

    Messages:
    70
    GitHub:
    FrostingBita
    Thank you all!
     
  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.