note 15957 added to language.types.type-juggling

From: Date: Wed, 10 Oct 2001 13:38:58 +0000
Subject: note 15957 added to language.types.type-juggling
Groups: php.notes 
Request: Send a blank email to php-notes+get-18767@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? -- http://www.php.net/manual/en/language.types.type-juggling.php http://master.php.net/manage/user-notes.php?action=edit+15957 http://master.php.net/manage/user-notes.php?action=delete+15957 http://master.php.net/manage/user-notes.php?action=reject+15957

« previous php.notes (#18767) next »