iPhone restarts if SIM card inserted
Hey,
Sometime ago my iPhone restarted by itself and I thought it was some kind of overheating precaucion because I left it outside in the sun for a while.
However, it keeps restarting whenever I open any app now that has passed like a month since that time.
I recently discovered that it only restarts if I have my SIM card in it.
It starts, I unlock my SIM card and then when i open any app it just shuts down and restarts.
I appreciate if anyone could help me or advise me on how to fix it
Thank you
iPhone 4, iOS 7.1.2