Page 1 of 1

Compressing strings

Posted: Fri Mar 18, 2005 3:50 am
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?

Posted: Fri Mar 18, 2005 4:29 am
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.