An iterative method for solving nonlinear functional equations