PHP: Hypertext Preprocessor (original) (raw)
bzwrite
(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)
bzwrite — Binary safe bzip2 file write
Description
bzwrite() writes a string into the given bzip2 file stream.
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 Values
Returns the number of bytes written, or [false](reserved.constants.php#constant.false)
on error.
Changelog
Version | Description |
---|---|
8.0.0 | length is nullable now. |
Examples
Example #1 bzwrite() example
<?php $str = "uncompressed data"; $bz = bzopen("/tmp/foo.bz2", "w"); bzwrite($bz, <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>s</mi><mi>t</mi><mi>r</mi><mo separator="true">,</mo><mi>s</mi><mi>t</mi><mi>r</mi><mi>l</mi><mi>e</mi><mi>n</mi><mo stretchy="false">(</mo></mrow><annotation encoding="application/x-tex">str, strlen(</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal">s</span><span class="mord mathnormal">t</span><span class="mord mathnormal" style="margin-right:0.02778em;">r</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord mathnormal">s</span><span class="mord mathnormal">t</span><span class="mord mathnormal" style="margin-right:0.02778em;">r</span><span class="mord mathnormal" style="margin-right:0.01968em;">l</span><span class="mord mathnormal">e</span><span class="mord mathnormal">n</span><span class="mopen">(</span></span></span></span>str)); bzclose($bz); ?>
See Also
Found A Problem?
There are no user contributed notes for this page.