3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait Bar { function __destruct() { print_r($this->things); } protected function addThing($n, $v) { $this->things[$n] = $v; } } class Foo { protected $things = [ '1' => 'one' ]; use Bar; public function __construct() { $this->addThing('2', 'two'); } } new Foo();

preferences:
40.28 ms | 402 KiB | 5 Q