note 52468 added to function.hexdec
| From: | JoeyMorwick at osu1 dot php dot net | Date: | Mon, 02 May 2005 20:07:01 +0000 |
| Subject: | note 52468 added to function.hexdec | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-88874@lists.php.net to get a copy of this message | ||
I found it helpful to have the inverse / reverse of this function laying around, since I wanted to
insert some binary data into an xmlrpc call (it currently craps out when you do that), and I
couldn't find one laying around, so here's a simple little function to do that:
function hex2bin($str) {
$build = '';
while(strlen($str) > 1) {
$build .= chr(hexdec(substr($str, 0, 2)));
$str = substr($str, 2, strlen($str)-2);
}
return $build;
}
----
Manual Page -- http://www.php.net/manual/en/function.hexdec.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+52468
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+52468&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+52468&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+52468&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+52468&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+52468&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+52468&report=yes
Search -- http://master.php.net/manage/user-notes.php