Code: $all = $this->getServer()->getOnlinePlayers(); put that in $this->ex["Players"][] as array. $this->ex["Players"][] = $all; this doesn't work. how can I?
Maybe you should use foreach. Code: foreach($this->getServer()->getOnlinePlayers() as $player){ $this->ex['Players'] = $player->getName(); } I don't know if it works.
That won't work, now you're setting a new name to the same key everytime. To achieve what you want you would need to use this Code: foreach($this->getServer()->getOnlinePlayers() as $player){ $this->ex['Players'][] = $player->getName(); } This will make an associative array like this: Code: <?php $arr = ["Players" => ["player1", "player2", "player3"]]; ?>