If you perform an "Erase All Content and Settings" it will wipe everything from the phone.
If you have either an iCloud backup or a backup through iTunes you can then restore the phone from either of those. It's easy enough to enable iCloud backup under the iCloud settings, however it will only work if you haven't recorded many videos, as iCloud only gives you 5GB of storage and 1080p videos take up a lot of space.
If you restore in this way it should put all your apps back on automatically by downloading them from the store, so you'll want to be on Wi-Fi when you do it. Once reinstalled you may need to re-login to some of them.
Also the music and videos that you've synced with iTunes, if any, should automatically re-sync the next time you connect it to iTunes.