As you may know, pthreads will not work well with arrays as it can't store them properly and it tries to serialize them. I spent a while trying to figure out how to get a basic array working. The below code just waits for messages and adds them to an ArrayObject which extends Stackable so it won't be serialized, so when you enter a message your console should be spammed repeatedly PHP: <?php/*__PocketMine Plugin__name=threadExampledescription=An Example!version=0.1author=Falkclass=threadExampleapiversion=11,12,13*/class threadExample implements Plugin { private $api; public function __construct(ServerAPI $api, $server = false){ $this->api = $api; } public function init(){ $this->msg = new Messages(); $this->loop = new msgLoop($this->msg); $this->loop->start(); $this->api->addHandler("player.chat", array($this,"addMessage"),50); } public function addMessage($data){ $this->msg[] = $data['message']; var_dump($this->msg); } public function __destruct(){ $this->loop->stop(); }}class Messages extends Stackable{ public function __construct() {} public function run(){}}class msgLoop extends Thread { public $t; public $msg; public function __construct(Messages $msg) { $this->t = array(); $this->stop = false; $this->msg = $msg; } public function stop() { $this->stop = true; } public function run() { while ($this->stop === false) { if(count($this->msg)) var_dump($this->msg); } exit(0); }}