How to change my IMEI number?

BEFORE ANSWERING, READ.
I have an iPhone 5 that's locked to O2 and I have a factory unlocked Samsung Galaxy Ace 2.
For what I know, the IMEI determines it being locked or unlocked carrier-wise. I'd like to change my iPhone's IMEI for my Ace 2's IMEI, only to have it factory unlock. I'm going on holidays and I need a SIM from the country I'm going to but since my iPhone is locked I wouldn't be able to put one in, so I want to change the IMEI so that I can. After that, I'll be back to the original SIM card and carrier.
I'm aware that changing an IMEI is illegal but what I'm planning on doing is swapping IMEI, both being my OWN private phones, aka private property.
No, I'm not able to use my Samsung because it has been through it's due life experiences and is now quite broken. I can still read the IMEI luckily, not the rest of the screen though.
That all said, how can I change the IMEI on my iPhone 5?

Added (1). Yes, Lara, you can. There are programs for it. What I'm asking for is HOW to do so.

You can't.

Y O U C A N N O T, you can desire to walk on mars but that doesn't make it possible in any reality we really live in. In the real world we don't always get everything we want, like your iPhone want made by Apple, you can't change that fact, you can't decide that your phone was made by Samsung because it suits you.

that being said, the "iemi" is your unique id of that phone, the first digits identify the phone carrier, yes. Like a cars VIN, it is how a phone is tracked and controlled by the mobile phone carriers.

  • What is the IMEI number used for on an iPhone and/or any phone? Just found it in my settings and I don't know what it's for. Could someone please tell me most of the ways it could be used?
  • Possible scam on iphone IMEI number? So i'm having 2 people talk to me through gumtree mail who both sound an awful lot like each other from what they're saying and how they talk, saying that my phones deffo on contract and they need the IMEI number to check, and that they're saying it'll get blocked and someone's told them its on contract etc, and that they were nearly scammed with the same phone i bought on gumtree before, what do you guys think, it sounds a bit fishy
  • My iPhone Serial Number (IMEI) has been blocked? I bought an iPhone off someone and the serial number (IMEI) has been blocked. It is on T - Mobile network. What can I do to get it un blocked? Can I get it unlocked to all networks if i pay for it as i have a Vodafone contract and would like to use it in the iPhone
  • Is it possible to change/crash/scramble the IMEI number of an iPhone 5s? I accidentally crashed the IMEI number of a Samsung Note 2 while flashing the stock ROM on it (CM11 was in use) and now a friend lost his iPhone and told me it's not possible to crash/scramble the IMEI on it. Is it possible to do so or not?