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

How can I do this right?

Discussion in 'Facepalm' started by Brendp, May 27, 2017.

  1. Brendp

    Brendp Creeper

    Messages:
    4
    GitHub:
    Brendobtu
    How to get the name and value in a public?
    public $top[$player->getName()] = 20;
     
  2. Intyre

    Intyre Administrator Staff Member PMMP Team

    Messages:
    81
    GitHub:
    Intyre
    1. You question doesn't make sense
    2. Learn more PHP
    3. Make a descriptive thread title
     
  3. GilBenDavid

    GilBenDavid Silverfish

    Messages:
    20
    i think that he mean how can he make a diffrent variable to players
     
  4. Intyre

    Intyre Administrator Staff Member PMMP Team

    Messages:
    81
    GitHub:
    Intyre
    See how bad it is? You THINK he means that but you can't be sure!
    You shouldn't have to guess what a person wants. It doesn't help him and annoys us!
     
  5. GilBenDavid

    GilBenDavid Silverfish

    Messages:
    20
    i not guess , i just look at the code and seen the array and he write
    how can he do this right
    Besides , what else can be done with an array in which an player

    you tell him to learn php when what that he asked is php
     
    Last edited by a moderator: May 27, 2017
  6. Intyre

    Intyre Administrator Staff Member PMMP Team

    Messages:
    81
    GitHub:
    Intyre
    :facepalm:
     
  7. Legoboy0215

    Legoboy0215 Witch

    Messages:
    64
    GitHub:
    legoboy0215
    I see why the facepalm section exists.
     
  8. Aviv

    Aviv Baby Zombie

    Messages:
    156
    You should try
    PHP:
    $this->top[$player->getName()] = 20;
    is that what you want? it basically makes a variable public
    There is also this method
    PHP:
    public $top = [];

    $this->top[$player->getName()] = 20;

    echo(
    $this->top[$player->getName()]); // 20
     
  9. Brendp

    Brendp Creeper

    Messages:
    4
    GitHub:
    Brendobtu
    Yes, thanks for your help
     
  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.