<?php class A { protected $data; protected $foo = ''; public function a() { (new B())->foo($this); var_dump($this); if (isset($this->data['test'])) { $this->foo = $this->data['test']; } } } class B { public function foo(&$var) { $var = 1; } } $a = new A(); $a->a();
You have javascript disabled. You will not be able to edit any code.