I have a a php string:
e.g. df299cc4cda279e4d7344b42a8006d94488c753f
This is representing a 20 bit HEX output. How would I select the n'th byte? For example if I select the 3rd one it should return 9c.
Thanks.
You can take a look at chunk_split() or str_split() and get a result like:
$string = "df299cc4cda279e4d7344b42a8006d94488c753f";
$bytes = str_split($string, 2);
$yourByte = $bytes[2];
$bytes = str_split($string, 2);
echo $bytes[2];
Or you may want to convert the string to actual binary using hex2bin, then echo the index [2] of the string, possibly converting back to hex for output.