The next time you’re stranded without an open WiFi network (but your 3G signal is going strong), you’ll be glad you installed Addition’s iPhoneModem 2 (free to try, full license is $9.99). Unfortunately, Apple has apparently deemed the app to be in conflict with its App Store Terms and Conditions, so it is only available for jailbroken phones via Cydia.
Once you install the app, Run the helper app and hit Connect to set up the network. The helper app sets up an ad hoc wireless network that can be accessed via iPhone. The default network it creates is called “iPhoneModem” and does not have a password (you can change this in the Preferences of the helper app). Now open up your iPhone’s Settings and tap WiFi. Make sure WiFi is turned on and select the network “iPhoneModem” (or whatever you called it). Type the password if you assigned one. Open up the Modem iPhone app and everything else will configure automatically. After a few moments the helper app and the iPhone app will confirm that a connection has been established and you can browse away with all the comforts of your laptop!