I ask for a user to input 4 numbers or letter from 1 – 9 and a-f.
i then take these numbers and letters and str_replace them with 4 byte values.
So if the user inputs 00FF, the value would be 0000 0000 1111 1111, as 0000 is the 4 byte value of 0 and 1111 is the 4 byte value of F.
I want to get rid of any leading '0's from the total collection of 4 byte values.
I have tried using the below code to get rid of the 0’s from the start of it.
$hexvalue2 = ltrim($hexvalue,'0');
echo $hexvalue2;
However, this is not working, when looking at PHP.net as far as my knowledge goes this seems correct, but obviously its not.
Can anyone tell me where i am going wrong please? or perhaps suggest an alternative?
Thank you
This works:
Output:
1111Note the
dechexto get a string.