The phone battery ran out dead while I was out. I connected it to a charger. After some time the iPhone started booting. But the phone never boots to the home screen. All I see is the spinning wheel and then it reboots again.
What was the phone doing when the battery ran out?
You could try plugin it to your computer, go to iTunes and from the iPhone's section restore it.