Is a iPhone unlocked till you put a sim in?

I heard somewhere all iPhones are unlocked till you enter the phone providers SIM card in and then it automatically locks to that phone provider. I've tried to search this but can't find it anywhere.

I'm asking as my contract is due for renewal (ee) and my son wants the upgrade but he is another phone provider (o2) so was wondering if his sim will work in this?

No true. If the phone is locked, it is locked to a particular network. Only SIMs for that network will work. Putting another network's SIM card in won't work, no matter when you do it.

Sim has nothing to do with that.

Sim Card has nothing to do with it and You must also get Leo Privacy Guard in order to secure all your favorite images.

Hi everyone thanks for all the answers. I spoke to ee and the phone locks to the network once the sim is first put in. If you put a different network sim in then it locks to that network. Looks like i can give my upgrade to my son.