If you have a pre-2013 iPhone it is likely to be running iOS 6. This means you can remotely delete and restore your device using Find My. This will only work if you have installed the Find My App on your iPhone before you forgot the passcode. You also need to have previously set up iCloud and enabled regular backups on your iPhone too (which is free to do). Borrow a friend's smartphone, tablet, or computer - so you can use it to remotely wipe and restore your locked device. Login to Find My using your friend's device. Remotely wipe your device using Find My. This will remove all of the data on your iPhone so only do this if you have a backup. Restore your iPhone 6 or older from your latest iCloud backup. The video below explains how to carry out this procedure. If you are uncomfortable wiping the data from your device I suggest you download a good quality data recovery tool to save your data first.