[PHP] How to write binary data to a file?
- Date: Tue, 26 Jul 2016 18:10:07 -0400
- From: David Spector <news@xxxxxxxxxxxxxxxxxxxxxx>
- Subject: [PHP] How to write binary data to a file?
All I can find in the PHP Manual for writing raw bytes (unsigned
integers) to a file is fwrite. But when I use it, it seems to write
characters, not raw bytes. For example, the value 1 (0b1) is actually
written as 0x31, not 0x01 as desired. Yes, the fopen was done with the
"b" mode specified.
It doesn't work this way in C or C++, and the PHP Manual says nothing
Web searches turn up nothing useful on this subject.
I have posted this question on three PHP fora, and have received only
unhelpful or irrelevant answers so far.
System: Windows 8.1, PHP 5.5.10
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php