This paper is concerned with the periodic (in time) solutions to an one-dimensional semilinear wave equation with $x$-dependent coefficient. Such a model arises from the forced vibrations of a nonhomogeneous string and propagation of seismic waves in nonisotropic media. By combining variational methods with saddle point reduction technique, we obtain the existence of at least three periodic solutions whenever the period is a rational multiple of the length of the spatial interval. Our method is based on a delicate analysis for the asymptotic character of the spectrum of the wave operator with $x$-dependent coefficients, and the spectral properties play an essential role in the proof.