Photon-number squeezing in nano- and microlasers