writing binary data to file

From: Date: Fri, 14 Jan 2005 07:41:59 +0000
Subject: writing binary data to file
Groups: php.general 
Request: Send a blank email to php-general+get-206355@lists.php.net to get a copy of this message
hi, I must change some bytes in array filled from a msssql text field; now I do: function adjust (&$ar_in) {
    $ar_in{0}='Ð';
    $ar_in{1}='Ï';
    $ar_in{3}='à';
    $ar_in{4}='¡';
    $ar_in{5}='±';
    $ar_in{7}='á';
} I've copied/pasted values from an hex editor and this works ok. Question is: does exists a more elegant way to do this, using directly hex values in the script? I tried $ar_in{0}=0xFF for example, but when I write on file I got hex 32 (ascii '2').

« previous php.general (#206355) next »