• PHP Video Tutorials

PHP - bzip2 Functions


Advertisements

The bzip2 functions can be used to transparently read and write bzip2 (.bz2) compressed files.

The Bzip2 module can use the functions of the bzip2 library by Julian Seward. This module can require bzip2/libbzip2 version >= 1.0.x.

Bzip2 can support in PHP is not enabled by default. We need to use them --with-bz2[=DIR] configuration option when compiling PHP to enable bzip2 support.

Example

<?php
   $filename = "/tmp/testfile.bz2";
   $str = "This is a test string.\n";
   $bz = bzopen($filename, "w");
   bzwrite($bz, $str);
   bzclose($bz);
   $bz = bzopen($filename, "r");
   echo bzread($bz, 10);
   echo bzread($bz);
   bzclose($bz);
?>  

Predefined Constants

This extension has no constants defined.

Sr.No Function & Description
1

bzclose()

This Function can close a bzip2 file.

2

bzcompress()

This Function can compress a string into bzip2 encoded data.

3

bzdecompress()

This Function can decompress the bzip2 encoded data.

4

bzerrno()

This Function can return a bzip2 error number.

5

bzerror()

This Function can return a bzip2 error number and error string in an array.

6

bzerrstr()

This Function can return a bzip2 error string.

7

bzflush()

This Function can force a write of all buffered data.

8

bzopen()

This Function can open a bzip2 compressed file.

9

bzread()

This Function is a binary-safe bzip2 file read.

10

bzwrite()

This Function is a binary-safe bzip2 file write.

php_function_reference.htm

Useful Video Courses


Video

PHP Online Training

45 Lectures 9 hours

Malhar Lathkar

Video

Become PHP Facebook Developer: Password-Less Authentication

34 Lectures 4 hours

Syed Raza

Video

Ultimate PHP & MySQL Web Development Course & OOP Coding

84 Lectures 5.5 hours

Frahaan Hussain

Video

Learn PHP from Scratch

17 Lectures 1 hours

Nivedita Jain

Video

E Commerce Website Development In PHP With PDO

100 Lectures 34 hours

Azaz Patel

Video

PHP in Telugu

43 Lectures 5.5 hours

Vijay Kumar Parvatha Reddy

Advertisements