note 15957 rejected from language.types.type-juggling by jimw
| From: | jimw@php.net | Date: | Wed, 10 Oct 2001 18:09:55 +0000 |
| Subject: | note 15957 rejected from language.types.type-juggling by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-18790@lists.php.net to get a copy of this message | ||
I want to write a binary file (gif) from a string containg HEX values (474946...F7...). Here is my
code:
$byte = hexdec(substr ($mystring, $i*2, 2));
$str=sprintf ("%c", $byte);
fwrite ($fp, $str, 1);
The trouble is $byte is an integer, so "F7" becomes FFFFFFF7. How can I cast it to a char?