What do i do first? If i restore?

If i restore my iphone do i have to erase the apps first or let erase the iphone erase them.

Restoring the iPhone basically makes it brand new. If you want to sell the phone or are sending it in to Apple, first, make a backup of the phone through iTunes and THEN restore it. You don't have to erase the apps first - the restore takes care of that.