You can start with an empty array for $data
like
// start with an fresh array for data $data = array(); // imagine your code here
Your code looks good.
EDIT: I missed your call to NOW (). Imho, you should add it also with a variable binding, for example
// bind date $data['created'] = date("Ymd H:i:s"); // updated prepare statement $sth = $this->db->prepare("INSERT INTO `user` (username, password, salt, email, created) VALUES (:username, :password, :salt, :email, :created)");
source share