# Bitwise with Hex && Hex to String

**URL:** <https://www.phphelp.com/t/bitwise-with-hex-hex-to-string/20051>\
**Category:** General PHP Help\
**Created:** [April 14, 2013, 3:50am UTC](https://www.phphelp.com/t/bitwise-with-hex-hex-to-string/20051 "2013-04-14T03:50:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://www.phphelp.com/uploads/default/original/2X/2/243e9ed5d93c5653ce3186f18df16e019ce38445.png) [@system](https://www.phphelp.com/u/system)\
**Post date:** [April 14, 2013, 3:50am UTC](https://www.phphelp.com/t/bitwise-with-hex-hex-to-string/20051/1 "2013-04-14T03:50:01Z")

</div>

Hi Thanks for your help I’ll just describe what I want to do any advice or if you could provide your own example it would really help, thanks again!

I have a string holding hex numbers “41495ab3edde720c” and I want to get those values out of the string and represent them as hexadecimal thus 0x41495ab3edde720c, then I want to xor that hex with another hex like

0x41495ab3edde720c ^ 0x1111111111111111

then I want to take the result which will be in this example (50584BA2FCCF631D)  
and turn it back into a string “50584BA2FCCF631D”

I’m not that good with php it seems hard to do this easily?

---

<div class="post-metadata">

**Author:** ![Redscouse](https://www.phphelp.com/user_avatar/www.phphelp.com/redscouse/32/124_2.png) [@Redscouse](https://www.phphelp.com/u/Redscouse)\
**Post date:** [April 14, 2013, 3:14pm UTC](https://www.phphelp.com/t/bitwise-with-hex-hex-to-string/20051/2 "2013-04-14T15:14:31Z")

</div>

checkout PHP’s functions for dealing with hex etc.

[http://php.net/manual/en/function.hexdec.php](http://php.net/manual/en/function.hexdec.php) 😉
