How to hard reset iphone if lock button is broken?

I know that the best way to fix an iphone that just shuts off is to "hard reset" it by holding the lock button and the home button, but my lock button just broke a few days ago. What do i do?

Added (1). Its an iphone 4, but i have no idea how to take the battery out

If its a 3G you can't but any other iPhone take the battery out and put it back in then power on