Next element for code Gray on PHP