Home | Help Forums | Web Design Tutorials | Free Swishmax Downloads | All Downloads

 

 

Company

Home

Nework Details

Tutorials

SWiSH 2

SWiSHMax

Flash MX

PHP & MySQL

HTML / JScript

Adobe Photoshop

Corel Draw

Gimp

Miscellaneous

Downloads

Templates

Plugins

Fonts

Wallpapers

Free Images

Scripts and Codes

Products

E-Books

SWiSH BB

SWiSH Templates

SWiSH-DB Newsletter
Subscribe to our newsletter : GO
  Partners / Affiliates

   Swish Templates
   SWiSH Climax
   GimpTalk
   Idea Designs
   Sposatoettore
   Try Acai Berry Diet
   Download Free Ringtones
   Swishzone

Manage your site with Flax Article Content Management System
Compressing Data with GZIP
Category : PHP / MySQL | Level : Beginner | Language : English
Ask Question | Read Comments | Post tutorial | Previous | Next

Web www.swish-db.com

QUICK TUTORIAL

If you wish o compress a string of any length, you can use GZIP compression functions such as
[*]gzcompress()
[*]gzuncompress()

there are some more functions on compression but we will eb using these two only.


HOW TO COMPRESS ?


//uncompressed (simple string before compression)
$str = "My Name is Ali Imran Khan Shirani - This is my uncompressed string";

//compressed version
$compressed = gzcompress($str,5);

WHAT is 5 USED FOR?

5 is used for compression level which is maximum 9
you may pass value 1 to 9. default is 0 which means no compression.



HOW TO UNCOMPRESS THE COMPRESSED VERSION OF STRING?

variable $compressed contains the compressed version of string variable $str;
we uncompress it and put the resulting string in $str.

$str=gzuncompress($compressed);

remember if you pass an uncompressed data to gzuncompress function it may return an error.


for more help on compress GZ files see tutorial
"Creating gz compressed files with php"



All rights reserved - swish-db.com