With dandruff, the cells turn over every 2 weeks and don't mature properly. That was back in 1873 and the fungus in question was found to live happily on our skin anyway, so the fungus theory lost favor. According to an article in the US Pharmacist magazine, another researcher revived the fungus theory over 100 years later and the doctors started prescribing antifungal shampoos like Nizoral to treat dandruff. Salicylic acid removes scales and helps the skin retain water by causing a slight inflammation of the top skin cells. Seems bizarre that it makes the skin turnover faster, when that has been cited as a cause in the first place, but it seems to help.
Salicylic acid can also be mixed with sulfur to treat dandruff.
Selenium sulfide is an antifungal and does the opposite to salicylic acid by slowing down the growth of skin cells. Ketaconazole is the main ingredient in Nizoral antifungal shampoo, but is not recommended for people under 12 years of age. You will also find this chemical in thrush creams. You would have also noticed zinc pyrithione in many anti-dandruff shampoos. It's an antifungal and antibacterial which helps stop itching and flaking.