If you want to erase all the data on an iphone, you can follow these instructions. When you factory reset your iphone, you will lose all of you data on the device and it will put it back to the state when you first bought it and it came out of the box.
If you plan on selling your iphone 4, you should do a factory reset so no one has access to your data. If you do not do a factory reset on your iphone 4, someone else may have access to your data, and you do not want this to happen.
You can factory reset your phone from itunes or directly from your iphone 4.
Step 1: Plug in your iPhone to your computer via the USB adapter cable.
Step 2: next you will want to sync your phone with iTunes. This will automatically create a backup of all your pictures, apps, music, and contacts. You can then use this backup to restore on another device.
Step 3: After you have completed the sync, scroll up to the top of the iPhone page in iTunes and click the Restore button in the top right.
To erase all your data directly from your iphone 4 without plugging it into your computer, you will want to follow these steps. This will erase all your data, so it is wise to back up your information first.
Step 1: Start your iphone 4 and find the Settings icon.
Step 2: Scroll down the list and find the option labeled General.
Step 3: Scroll to the bottom of this menu and tap the Reset tab.
Step 4: Hit Erase All Content and Settings.
Step 5: If you are ready to clear everything from your iphone 4, tap the Erase iPhone button.