No. All you can do is remember that pass code.
Should the unthinkable happen and you forget it, you can restore the phone back to factory using iTunes. If you use the iTunes you initially set up the phone with, you can pretty much put it back the way it was. You just need a recent backup.
The key is: make backups! Cannot emphasize this enough - make a plan to regularly backup your iDevice. Then, should anything go wrong, you can get most of your data and settings back.
Note that this applies to iPads, also, not just to phones that the OP mentioned.
Oh, and for iOS 7 - if you go to restore the iOS (or upgrade) and you have "Find My iPhone/iPad" enabled - iTunes will prompt you to enter the AppleID and password you used in initial set-up of the iDevice. This is a security feature that is new to iOS 7.
I hadn't forgotten it but some update had happened that locked me out, that's why I was frightened to do the update to ios7.