note 101833 deleted from function.dechex by danbrown
| From: | danbrown@php.net | Date: | Wed, 13 Jun 2012 15:22:47 +0000 |
| Subject: | note 101833 deleted from function.dechex by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-188563@lists.php.net to get a copy of this message | ||
Note Submitter: Rod
----
After numerous hours of trying to actually receive a hexadecimal digit from dechex, I decided to
give it a go myself.
I kept trying to do bitwise comparisons on the result however I was comparing strings,
<?php
function dectohex($dec){
$code='return 0x'.dechex($dec).';';
return eval($code);
}
?>
This actually returns a hexadecimal value, not a string representation.
Hopefully this saves someone else a couple of hours.