I have the follow code:
$binary = \"110000000000\"; $hex = dechex(bindec($binary)); echo $hex; ?>
Which works fine, and I get a valu
Use str_pad() for that:
// maximum number of chars is maximum number of words // an integer consumes on your system $maxchars = PHP_INT_SIZE * 2; $hex = str_pad($hex, $maxchars, "0", STR_PAD_LEFT);