Re: [PHP] How to write binary data to a file?
- Date: Wed, 27 Jul 2016 01:09:15 +0200
- From: shiplu <shiplu.net@xxxxxxxxx>
- Subject: Re: [PHP] How to write binary data to a file?
On Wed, Jul 27, 2016 at 12:45 AM, David Spector <news@xxxxxxxxxxxxxxxxxxxxxx
This is wrong. You are first casting $IDByte as int. But fwrite accepts the
second parameter as string. So what it does is convert it back to string.
I think what you are looking for is fprintf($Res, "%c", $IDByte). But it
assumes that $IDByte is lower than 255 otherwise it'll consume more than 1
byte. If its more than one byte how do align them. Do you write on left or
right. These are all encoding stuff.
*Innovation distinguishes between follower and leader *
— Steve Jobs
*An expert is a person who has made all the mistakes that can be made in a
very narrow field.*— Neils Bohr