<?php $str = base64_decode("EAE="); echo $str."<br>"; $strl= strlen($str); for ($i = 0;$i < $strl; $i++) { $char = bin2hex(substr($str,$i,1)); echo $char; } //$test = '&#x'.bin2hex($str); //echo $str;