Re: [PHP] How to write binary data to a file?
- Date: Wed, 27 Jul 2016 01:58:21 +0200
- From: Christoph Becker <cmbecker69@xxxxxx>
- Subject: Re: [PHP] How to write binary data to a file?
On 27.07.2016 at 01:47, David Spector wrote:
> Clearly, the problem was with fwrite converting its value to a
> character. It shouldn't do this, IMO, since fwrite is documented as
> working both for string and binary arguments (depending on the 'b' mode
> of fopen).
The "b" mode only prevents line endings (CR/LF) to be converted to the
platform's convention. "binary safe" means that NUL characters (\0) can
be contained in the string (contrary to C).
> Anyway, thank you for the solution, even though PHP is acting very
> non-intuitively here.
However, it is rather consistent with itself here.
Christoph M. Becker
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php