<?php
function serial2txt($hex) {
$str = '';
for($i=0;$i<4;$i++) $str .= substr($hex,$i,2);
$str .= "-";
for($i=4;$i<strlen($hex);$i++) $str .= dechex(ord(substr($hex,$i,1)));
return $str;
}
$hex = "5A 54 45 47 C1 71 FB 81";
$return_value = serial2txt($hex);
echo "Returned value from the function :$return_value\n";
?>
Returned value from the function :5AA 554-34203435203437204331203731204642203831
.1.3.6.1.4.1.3902.1012.3.13.3.1.2.268567040.1 = Hex-STRING: 43 4E 31 38 09 08 16 37
.1.3.6.1.4.1.3902.1012.3.13.3.1.2.