Does unlocking your iphone 4s erase all of its memory/data?

If I unlock my 4s will it erase all of its data (photos, messages, contacts, etc.)

Added (1). Just unlocking it from its carrier btw

If you forgot the password, and your unlocking it, yes it will erase all data

No it won't.It'll just unlock it's network so that you'll be able to use it to different carriers.