3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { private $field; public function setFiled($field) { $this->field = $field; } public function getField() { return $this->field; } } $test1 = new Test(); $test2 = new Test(); $test1->setField(10); $arr = array(); $arr[] = $test1; $arr[] = $test2; var_dump($arr); //$arr[0]->setField(10); //$arr[1]->setField(20);

preferences:
33.96 ms | 402 KiB | 5 Q