Compressing strings

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Shendemiar
Forum Contributor
Posts: 404
Joined: Thu Jan 08, 2004 8:28 am

Compressing strings

Post by Shendemiar »

I intend to have some of my gamedata as long strings and to store them in the database. I also think od compressing them while they are in the database. Whats the best way to do this? Any compression classes that result as string not file? What type of a database field i need to use? Any suggestions, pro's, con's?
Shendemiar
Forum Contributor
Posts: 404
Joined: Thu Jan 08, 2004 8:28 am

Post by Shendemiar »

Code: Select all

<?php

  $ot = "This is a test. This is only a test. This is not an important string.";
  $ct = gzcompress($ot,9);
  echo $ct."<BR>";
  $ct = gzuncompress($ct);
  echo $ct;

?>
Seems to work fine.
Post Reply