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

Question about an array

Discussion in 'Development' started by TestDevelopment, May 28, 2021.

  1. TestDevelopment

    TestDevelopment Spider Jockey

    Messages:
    41
    GitHub:
    non
    How is it possible to add fast a large amount of items to an array.

    Like forlooping a area of blocks an then add it to an array foreach block.

    Possible? If yes please tell me :)
     
  2. minijaham

    minijaham Skeleton

    Messages:
    801
    GitHub:
    minijaham
    Technically anything is possible in PMMP.

    + I'm not really sure what you mean. Could you please explain in more detail, with proper English grammar please?
     
  3. ComorDev

    ComorDev Spider

    Messages:
    11
    GitHub:
    comordev
    The array can be quickly filled with a loop, but at the expense of saying "Like forlooping a area of blocks an then add it to an array foreach block." could you tell us in more detail?
     
  4. TestDevelopment

    TestDevelopment Spider Jockey

    Messages:
    41
    GitHub:
    non
    i want to add like 50000 entrys in a array in like a second or so
     
  5. Axon

    Axon Zombie

    Messages:
    276
    You can use array push to push data into an array.
    PHP:
    array_push($array$values );
    Example:
    PHP:
    $array = [];
    foreach(
    $this->plugin->getServer()->getOnlinePlayers() as $player){
        
    array_push($array$player);
    }
     
    Agent likes this.
  6. TestDevelopment

    TestDevelopment Spider Jockey

    Messages:
    41
    GitHub:
    non
    this wont work for me -.-
     
  7. Axon

    Axon Zombie

    Messages:
    276
    What data are you trying to store? What have you tried? Give examples xd
     
    Agent likes this.
  8. TestDevelopment

    TestDevelopment Spider Jockey

    Messages:
    41
    GitHub:
    non
    i just stored a bool and a string
     
  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.