How can I set the value of a taxonomy term reference to multiple terms using PHP? This question describes how to set the value of a term reference field using PHP.  But what do I do if I want to set the value of a term reference field in the user profile to multiple terms?

I am trying to set the value to term IDs 27 and 28.  Here is my code so far:

$user-&gt;field_yourfield_name[LANGUAGE_NONE][0]['tid'] = 27;
user_save($user);
Assuming the field is set up to accept multiple records...

$user-&gt;field_yourfield_name[LANGUAGE_NONE][0]['tid'] = 27;
$user-&gt;field_yourfield_name[LANGUAGE_NONE][1]['tid'] = 28;
// etc


Or you can just keep appending to the array (without knowing the next available index) like this:

$user-&gt;field_yourfield_name[LANGUAGE_NONE][]['tid'] = 27;
$user-&gt;field_yourfield_name[LANGUAGE_NONE][]['tid'] = 28;