The objective is to convert a dec base number between 0 and 255 into a hex base number. The hex base number has to be written in a form XX. So eg 60_10=3c_16, but also 5_10=05_16.
For example:
Number 60 in dec base is 3c in hex base.
The following code works:
<?php
echo dechex(60);
?>
The output is: 3c
Bingo.
And now: Why is the output of the following code 03 instead of 3c? What can I do to make it 3c?
<?php
$br=60;
echo sprintf("%02x", dechex($br));
?>