UnixDevel Posted March 11, 2021 Report Posted March 11, 2021 (edited) public function __construct($parameters = null) { if (! $parameters) { return; } if ($parameters instanceof stdClass) { $parameters = get_object_vars($parameters); } foreach ($parameters as $property => $value) { if (property_exists($this, $property)) { $this->$property = $value; } } } Edited March 12, 2021 by lzomedia 1 Quote