<?php class Wrapper { public $values = [1,2]; public function foo (...$args) { return $this->dostuff(...$args); } public function dostuff($param1, $param2) { $this->values[] = $param1; $this->values[] = $param2; return count($this->values); } public function returnArray() { return $this->values; } } $values = [1,2]; $obj = new Wrapper(); $count = $obj->foo(3,4); echo "Elements count: $count\r\n"; print_r($obj->returnArray()); //Expected [1,2,3,4]
You have javascript disabled. You will not be able to edit any code.