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

bzerror

Description

The bzerror of bzip2 for PHP returns the bzip2 error number and error string in an array.

Syntax

bzerror(
    resource $bz
): array

Parameters

bz

The file pointer. It must be valid and must point to a file successfully opened by bzopen().

Return

Returns an associative array, with the error code in the errno entry, and the error message in the errstr entry.

Examples

1 · bz · array

<?

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

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

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

    $return = bzerror($bz);

    print_r($return);

bzclose($bz);

?>
Array
(
    [errno] => 0
    [errstr] => OK
)

2 · bz · array · index

<?

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

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

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

    $return = bzerror($bz);

    echo $return["errno"] . PHP_EOL;
    echo $return["errstr"];

bzclose($bz);

?>
0
OK
HomeMenu