When was Root Beer Invented?

It is said that Root beer was invented by a Philadelphia pharmacist named Charles Hires purely by accident while trying to create a new miracle drug. Hires introduced his concoction at the 1876 Philadelphia Centennial Exhibition.