3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public $test = 0; public function __construct($x){ $this->test = $x; } } $array = array( new Test(1), new Test(2), new Test(3), new Test(4), ); foreach($array as $key=> &$item){ $item->test +=10; } var_dump($array);

preferences:
43.47 ms | 402 KiB | 5 Q