public function get() { return $this->_some; } } trait Call { public function __call($method, $args) { $reflection = new ReflectionObject($this); foreach ($reflection->getProperties() as $property) { $transformedPropertyName = str_replace('_', '', $property->getName()); $property->getName(); current($args); } } } class A { use Hello, Call; protected $_name = ''; } $a = new A(); $a->set('cal'); $a->get(); $a->setName('Jo');
<?php class A { public $a; public function set($obj) { $obj->a = 5; } } $obj = new A(); $obj->a = 6; $obj->set($obj); echo serialize(array('section' => 'countries', 'q' => 1));