bzwrite
Description
Syntax
bzwrite( resource $bz, string $data, ?int $length = null ): int|false
Parameters
bz
The file pointer. It must be valid and must point to a file successfully opened by bzopen().
data
The written data.
length
If supplied, writing will stop after length (uncompressed) bytes have been written or the end of data is reached, whichever comes first.
Return
Returns the number of bytes written, or false on error.
Examples
1 · bz data
<? $file = $_SERVER["DOCUMENT_ROOT"] . "/assets/bz2/1.bz2"; $mode = "w"; $bz = bzopen($file, $mode); if($bz === false) { die("bzopen"); } $data = "data"; $return = bzwrite($bz, $data); var_export($return); bzclose($bz); ?>
4
2 · length
<? $file = $_SERVER["DOCUMENT_ROOT"] . "/assets/bz2/1.bz2"; $mode = "w"; $bz = bzopen($file, $mode); if($bz === false) { die("bzopen"); } $data = "data"; $length = 2; $return = bzwrite($bz, $data, $length); var_export($return); bzclose($bz); ?>
2