what is mechanism for reaction phenol + dimethylsulphate -> anisole
The methylation of Phenol using Dimethyl Sulfate is an Electrophilic Methylation and happens through a SN2 nucleophilic attack. Phenol is first deprotonated by the sodium hydroxide as you already thought. The deprotonation of Phenol is favored because the pKa of Phenol is lower than the pKa of water meaning $\ce{OH-}$ is a stronger conjugated base than $\ce{PhO-}$:



The formed Phenolate is a good nucleophile, and will attack the methyl groups of the Dimethyl Sulfate. Those methyl groups are readily attacked by nucleophiles because of the great induction effect caused by the neighbor atoms which are much more electronegative than the carbon atom, which makes those more positively charged. This makes the methyl groups good electrophiles, hence the reaction name "Electrophilic Methylation": If we focus on the methylating reactant, it's performing an Electrophilic Attack.

Below is the reaction mechanism:





EDIT: Thanks @user55119 for pointing out that only one methyl group of the Dimethyl Sulfate reacts under normal circumstances, requiring 1 equivalent of Dimethyl Sulfate per Hydroxyl Group and not 1:2 as I previously thought