public function __construct($array = null) { parent::__construct(); if ($array != null) { foreach ($array as $row => $v) { $this->{$row} = $v; } } }
public function __construct($array = null) { parent::__construct(); if (is_numeric($array)) { $this->id = $array; } else { if (is_array($array)) { foreach ($array as $row => $v) { $this->{$row} = $v; } } } }