How to erase data on my old iPhone so I could sell it?

So I bought a new iPhone and now I want to sell the old one on eBay, but I don't know how to erase all the data on my old one so that it doesn't affect my new one

First, go to Settings>iCloud>turn off Find My iPhone, and then log out of your Apple ID;
then go to Settings>General>About>Erase all Content & Settings

Just go into Settings, choose General, then scroll down to Reset and choose Erase All Content and Settings