pub fn output_write(data: &[u8]) -> usizeExpand description
Writes binary data to PHP’s output stream with output buffering support.
This function is binary-safe (can handle NUL bytes) AND respects PHP’s
output buffering (ob_start()). Use this when you need both binary-safe
output and output buffering compatibility.
§Arguments
data- The binary data to write.
§Returns
The number of bytes written.
§Comparison
| Function | Binary-safe | Output Buffering |
|---|---|---|
printf | No | Yes |
write() | Yes | No (unbuffered) |
output_write | Yes | Yes |
§Example
ⓘ
use ext_php_rs::zend::output_write;
// Binary data that will be captured by ob_start()
let data = b"Hello\x00World";
output_write(data);