Hi guys,
How would I do compare two Hex numbers to find their difference?
I've tried hexdec() and then adding/subtracting but some of these numbers vastly differ, and simply doing $hex_number - $hex_number2 always returns 0.
Anyone know anything about this?
Thanks in advance
How to do simple Maths with Hex?
Moderator: General Moderators
- mikeeeeeeey
- Forum Contributor
- Posts: 130
- Joined: Mon Jul 03, 2006 4:17 am
- Location: Huddersfield, UK
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: How to do simple Maths with Hex?
You could use base_convert(), or maybe try something like:
Code: Select all
"0x$hex_number" - "0x$hex_number2"(#10850)
- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact:
Re: How to do simple Maths with Hex?
base_convert() FTW!