I have a 2 byte long hex string and need to bitwise shift the 1st one a byte to the left and then add the 2nd byte to it. Both strings come from a 32 character long string. The strings come from a data file I am parsing.
$hex="05E000752F0100D0A500503891FB199A"; //example line of data from file
$vcanvbatt=(base_convert(((base_convert(substr($hex,12,2),16,2)<<8)+base_convert(substr($hex,14,2),16,2)),2,10))/100;
You don’t need to convert to binary at all, simply shifting decimal numbers will do. If I understand the math you need correctly, this should work: