php_output

Macro php_output 

Source
macro_rules! php_output {
    ($data: expr) => { ... };
}
Expand description

Writes binary data to PHP’s output stream with output buffering support.

This macro is both binary-safe (can handle NUL bytes) AND respects PHP’s output buffering (ob_start()). Use this when you need both capabilities.

§Arguments

  • $data - A byte slice (&[u8]) or byte literal (b"...") to write.

§Returns

The number of bytes written.

§Comparison

MacroBinary-safeOutput Buffering
php_print!NoYes
php_write!YesNo (unbuffered)
php_output!YesYes

§Examples

use ext_php_rs::php_output;

// Write binary data that will be captured by ob_start()
php_output!(b"Hello\x00World");

// Use with output buffering
// ob_start();
// php_output!(b"captured");
// $data = ob_get_clean(); // Contains "captured"