Actually my 4S works that way, when i'm at home or at work 3G seems to be off.
The iPhone will stop using the cellular network to send and receive data if it is connected to a Wi-Fi network.
The exception to that is MMS and Visual Voicemail (where supported), which will continue to run over the cellular network.
3G is however not disabled (for the reasons I mentioned earlier).
Last edited: