How to turn off iPhone without power button?

My iPhone's power button is broken. How can I still turn it off to send it in for repairs? I found another answer, but it does not really help.


If you go to Settings>General>Accessibility>AssistiveTouch and flip the switch to "on," you will find a black square with a white dot in the middle.

When you tap the white circle for AssistiveTouch, tap "Device," then LONG PRESS on the "Lock Screen" option. You should be set!