Q: Is prayer invalidated due to clearing the throat without need (hawking), talking or laughing?
A: Yes. Clearing one’s throat without need, talking, or laughing which produces 2 syllables or more during prayer or after you forgetfully finish prematurely (requiring you to complete prayer and perform sujud sahwu) invalidates the prayer altogether.
There is a secondary narration from Imam Ahmad that it is not invalidated due to a little talking which is for the benefit of the prayer after a premature salaam. This would be like someone saying, ‘we have another rak’ah’ or ‘you finished early’. This opinion was adopted in al-Iqna and other works.
Source: Hidayat al-Raghib