public function hex2str($hex){ $str = ''; $arr = str_split($hex, 2); foreach($arr as $bit){ $str .= chr(hexdec($bit)); } return $str; }