3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public $bar = array('x' => array('a' => 'x1', 'b' => 'x2'), 'y' => array('a' => 'y1', 'b' => 'y2')); public function test() { foreach ($this->bar as $b => $c) { $b['a'] = 'hello'; } } } $foo = new Foo(); $foo->test(); var_dump($foo->bar);

preferences:
44.3 ms | 402 KiB | 5 Q