The function of a soap dispenser is to hold and dispense soap in a controlled and hygienic manner. Soap dispensers are commonly used in bathrooms and kitchens to provide liquid soap for hand washing. They can also be used to dispense other types of liquid products, such as lotion or hand sanitizer. Soap dispensers help to maintain a clean and organized space, as they prevent the accumulation of soap residue and prevent cross-contamination between users. They are available in a variety of designs and styles to suit different needs and preferences.