HomeMenu
Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

bzopen

Description

The bzopen of bzip2 for PHP opens a bzip2 compressed file.

Syntax

bzopen(
    string|resource $file,
    string $mode
): resource|false

Parameters

file

The name of the file to open, or an existing stream resource.

mode

The modes 'r' (read), and 'w' (write) are supported. Everything else will cause bzopen() to return false.

Return

Returns a pointer to the newly opened file on success, otherwise false if the open fails.

Examples

1 · file mode · r

<?

$file = $_SERVER["DOCUMENT_ROOT"] . "/assets/bz2/1.bz2";
$mode = "r";

$return = bzopen($file, $mode);

    if($return === false)
    {
        die("bzopen");
    }

    var_export($return);

bzclose($return);
NULL

2 · file mode · w

<?

$file = $_SERVER["DOCUMENT_ROOT"] . "/assets/bz2/1.bz2";
$mode = "w";

$return = bzopen($file, $mode);

    if($return === false)
    {
        die("bzopen");
    }

    var_export($return);

bzclose($return);
NULL