Location: PHPKode > scripts > ArZipStr > arzipstr/sp_example.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1" />
<link rel="stylesheet" type="text/css" href="style.css" media="all" />
<title>Spanish Text Compressor</title>


<div style="width: 80%; position:absolute; left:10%; top:0%; z-index:1">
<br />
<div class="tabArea" align="center">
  <a class="tab" href="ar_example.php">Arabic Example</a>
  <a class="tab" href="en_example.php">English Example</a>
  <a class="tab" href="fr_example.php">French Example</a>
  <a class="tab" href="gr_example.php">German Example</a>
  <a class="tab" href="it_example.php">Italian Example</a>
  <a class="tab" href="sp_example.php">Spanish Example</a>
  <a class="tab" href="about.html">About</a>

<div class="Paragraph">
    $obj = new SpZipStr();

    $file = 'sp_example.txt';
    $fh   = fopen($file, 'r');
    $str  = fread($fh, filesize($file));

    $zip  = $obj->compress($str);

    $before = strlen($str);
    $after  = strlen($zip);
    $rate   = round($after*100/$before);

    echo "String size before was: $before Byte<br>";
    echo "Compressed string size after is: $after Byte<br>";
    echo "Rate $rate %<hr>";

    $str = $obj->decompress($zip);

    $word = 'gobierno';
    if($obj->search($zip, $word)){
        echo "Search for $word in zipped string and find it<hr>";
        echo "Search for $word in zipped string and do not find it<hr>";

    $len = $obj->length($zip);
    echo "Original length of zipped string is $len Byte<hr>";
<div align="justify">
<?=nl2br($str); ?>

          <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
          <script type="text/javascript">
          _uacct = "UA-1268287-1";
Return current item: ArZipStr