Update user meta array using foreach

Make sure to have identical keys in both of the arrays.
Keys ‘first_name’, ‘last_name’ and respective keys ‘fname’, ‘lname’ are different. If you can make them identical then first do it, otherwise you will either need to do string manipulation for these keys before using them or put a condition like below in the foreach loop –

foreach($user_meta_fields as $user_meta_field){
 if ($user_meta_field == 'first_name'){
    update_user_meta($current_user->ID, $user_meta_field, $post_data['fname']);
 }
 else if ($user_meta_field == 'last_name'){
    update_user_meta($current_user->ID, $user_meta_field, $post_data['lname']);
 }
 else{
    update_user_meta($current_user->ID, $user_meta_field, $post_data[$user_meta_field]);
 }

}

Otherwise, if all the keys are made identical, then generic solution –

foreach($user_meta_fields as $user_meta_field){
      update_user_meta($current_user->ID, $user_meta_field, $post_data[$user_meta_field]);
    }