Compress/Decompress Functions in PHP

Closed Posted Jan 14, 2009 Paid on delivery
Closed Paid on delivery

I need two PHP functions coded to compress an ASCII string of any length (approx 7-8 thousand characters) to a "compressed" output. The compressed string (alphanumeric) should not have more than 80 characters into it.

Example:

Function Compress($string)

Function Decompress ($string)

Usage example:

$str = "This is a long string that may contain any printable ASCII characters, including but not limiting to ~!#$%':232\"()_+. and escaped characters"

$cstr = compress($str)

echo $cstr // This should display an alpha-numeric string upto 80 char or less.

$dstr = decompress($cstr)

echo $dstr // This should display the same content as $str

I don't want to rely on any libraries (e.g. bzcompress) or gzip for these functions to work.

Just simple byte/bit shifting or hashing algorithm should do the job I think.

To give you better understanding, I have a advance search page into my application which generates the dynamic SQL query based on the user's selection criteria from the advance search page. Sometimes query might get very complex and the entire length of the query becomes somewhere upto 8000 characters. So I want to compress the entire query (into alphanumeric characters).

Pls note. Only serious bidders will be entertained.

PHP

Project ID: #370327

About the project

4 proposals Remote project Active Feb 17, 2009

4 freelancers are bidding on average $58 for this job

miks

Hi, it is not clear why you want to do this. But we can discus it on PMB and get fair price.

$30 USD in 4 days
(5 Reviews)
2.3
partizanx2

It's impossible to compress 8000 bytes to 80 (100 times!) and then decompress it. But I sure, we can find ways to solve your problem. Please, give more details

$50 USD in 3 days
(1 Review)
1.2
goldenyear

Please check my PMB. Thanks.

$100 USD in 1 day
(0 Reviews)
0.0
safarath

will be done with the best possible solution. Let me know mpre about thr project, ready to start work immediately.

$50 USD in 3 days
(0 Reviews)
0.0