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

Arrays

Discussion in 'Development' started by Remarkabless, Jan 11, 2018.

  1. Remarkabless

    Remarkabless Slime

    Messages:
    83
    GitHub:
    Remakem
    i see other threads but none are specific to this problem.


    How can I add Players to an array
    P
    $team1= [];

    onJoin(){
    $player->addtoarray

    }
    Also how can I make sure there isnt more than 2 people in an array
     
  2. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    Adding an element to an array:
    PHP:
    $team1[] = $player
    PHP:
    if(count($team1) > 2){
      
    // There's more than two people in there
    }
    Both questions could've been solved within 5 minutes of research
     
    kazuya, Irish and SOFe like this.
  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.