note 28555 added to function.bin2hex
| From: | admin at rack1 dot php dot net | Date: | Thu, 16 Jan 2003 19:04:51 +0000 |
| Subject: | note 28555 added to function.bin2hex | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-42234@lists.php.net to get a copy of this message | ||
Some gave a function to convert a hex code back into a simple text (human readable ASCII :P)
Some else gave a function that makes use of bin2hex to convert URLs into something like %12%34%56
Here is a function to go from the form %12%34%56 back into ASCII
Note that this function can easily be changed in order to transform any hex code into ASCII
<?
function _hex2text($str) {
$str = explode('%', $str);
array_shift($str);
$nmlstr = '';
foreach($str as $hexstr) {
$nmlstr .= chr(base_convert($hexstr, 16, 10));
}
return $nmlstr;
}
?>
'hope this helps :)
Regards
-Tsuna
--
http://www.php.net/manual/en/function.bin2hex.php
http://master.php.net/manage/user-notes.php?action=edit+28555
http://master.php.net/manage/user-notes.php?action=delete+28555
http://master.php.net/manage/user-notes.php?action=reject+28555