Req #45864 [Opn]: wish: fwrite to support direct output of bytes (not cast to string)
| From: | cmb@php.net | Date: | Tue, 07 Jul 2015 22:33:54 +0000 |
| Subject: | Req #45864 [Opn]: wish: fwrite to support direct output of bytes (not cast to string) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-194191@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=45864&edit=1
ID: 45864
Updated by: cmb@php.net
Reported by: php at richardneill dot org
Summary: wish: fwrite to support direct output of bytes (not
cast to string)
Status: Open
Type: Feature/Change Request
-Package: Feature/Change Request
+Package: *General Issues
PHP Version: 5.2.6
Block user comment: N
Private report: N
New Comment:
That seems too low-level to me. As PHP strings may contain
arbitrary bytes, you can easily build up the desired output
string(s) with pack('c*', ...) and write this/these to the file.
Previous Comments:
------------------------------------------------------------------------
[2008-08-19 15:50:44] php at richardneill dot org
Description:
------------
fwrite() outputs to file as a string. While this is usually a
sensible default, it can be rather annoying when I actually want to
output raw data. I know about using chr(), but that's ugly at least.
My request: add an option to fwrite that lets you output a char,
rather than a string.
[The chr() workaround is also not very visibly documented].
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=45864&edit=1