'idnumber' and 'icq' are initialized twice.
$optional = array("idnumber" => 1,
"icq" => 1,
"phone1" => 1,
"phone2" => 1,
"address" => 1,
"url" => 1,
"description" => 1,
"mailformat" => 1,
"maildisplay" => 1,
"htmleditor" => 1,
"autosubscribe" => 1,
"idnumber" => 1,
"icq" => 1,
"course1" => 1,
"course2" => 1,
"course3" => 1,
"course4" => 1,
"course5" => 1,
"group1" => 1,
"group2" => 1,
"group3" => 1,
"group4" => 1,
"group5" => 1,
"type1" => 1,
"type2" => 1,
"type3" => 1,
"type4" => 1,
"type5" => 1,
"role1" => 1,
"role2" => 1,
"role3" => 1,
"role4" => 1,
"role5" => 1,
"password" => $createpassword,
"oldusername" => $allowrenames);