One of the 45 questions in this topic
The 'Erase All Content and Settings' option in Settings resets the iPhone to its factory state, deleting all data and settings.