Test Ar-PHP Functionality Online

header line!
Test PHP Function










Ar-PHP Manual

static method decompress [line 213]

static string decompress( binary $bin)

Uncompress a compressed string



Tags:

return:  The original uncompressed string
author:  Khaled Al-Sham'aa <khaled@ar-php.org>
access:  public


Parameters:

binary   $bin   The text compressed by compress().

Example
  1.  include('./I18N/Arabic.php');
  2.  $obj new I18N_Arabic('CompressStr');
  3.  
  4.  $obj->setInputCharset('windows-1256');
  5.  $obj->setOutputCharset('windows-1256');
  6.  
  7.  $file 'Compress/ar_example.txt';
  8.  $fh   = fopen($file'r');
  9.  $str  = fread($fhfilesize($file));
  10.  fclose($fh);
  11.  
  12.  $zip $obj->compress($str);
  13.  
  14.  $before = strlen($str);
  15.  $after  = strlen($zip);
  16.  $rate   = round($after 100 $before);
  17.  
  18.  echo "String size before was: $before Byte<br>";
  19.  echo "Compressed string size after is: $after Byte<br>";
  20.  echo "Rate $rate %<hr>";
  21.  
  22.  $str $obj->decompress($zip);
  23.  
  24.  if ($obj->search($zip$word)) {
  25.      echo "Search for $word in zipped string and find it<hr>";
  26.  else {
  27.      echo "Search for $word in zipped string and do not find it<hr>";
  28.  }
  29.  
  30.  $len $obj->length($zip);
  31.  echo "Original length of zipped string is $len Byte<hr>";
  32.  
  33.  echo '<div dir="rtl" align="justify">'.nl2br($str).'</div>';
Popular
Recent
Links
Ads!
footer line!

No Software Patents! General Public License

Home | Twitter | Blog | Contact

Copyright © 2006 - 2016 Khaled Al-Sham'aa