Why does my iPhone work with safari even when Wi-Fi is turned off?

I usually keep the Wi-Fi off on my phone to save battery, and one day I went on safari to look something up. I noticed that it still worked even when my Wi-Fi was turned off. Why is this happening? Does it connect somewhere else, or to the same Wi-Fi even if its turned off?

You might be using your data.

Its using your data. You're paying for it. You can also turn your data off by going to settings. However, if you turn your data off and are not on Wi-Fi you won't be able to receive iMessages.
In case you didn't know, iMessage is from one apple product to another. These messages are in blue. And the green are just text messages.

Its using your 3g. Iphones don't have to have Wi-Fi to go on the internet. That is why you pay $30 a month for internet