In this paper, the authors propose a novel stochastic approach, i.e., the ElectroMagnetism-like (EM-like) algorithm, is applied to phase-only syntheses of antenna arrays. The goal is to minimize the pattern sidelobe under null-steering constraints by phase-only adjusting. The mechanism of EM-like algorithm results from the Coulomb's Law of Electromagnetics. It does not require gradient calculations and can automatically converge at a good solution through the virtual charge of each particle. Simulation results show that the EM-like algorithm can well treat the phase-only optimization of antenna arrays.