test = $val; } public function setVal( $val ) { $this->test = $val; } public function getVal() { return $this->test; } } function change_val( $class ) { $class->setVal( 'testing from function' ); } $obj = new TestC('testing from construct'); call_user_func( 'change_val', $obj ); echo $obj->getVal(); // returns "testing from function" ?>