gzencode_variation1-win32.phpt 912 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. --TEST--
  2. Test gzencode() function : variation
  3. --SKIPIF--
  4. <?php
  5. if( substr(PHP_OS, 0, 3) != "WIN" ) {
  6. die("skip only for Windows");
  7. }
  8. if (!extension_loaded("zlib")) {
  9. print "skip - ZLIB extension not loaded";
  10. }
  11. ?>
  12. --FILE--
  13. <?php
  14. /* Prototype : string gzencode ( string $data [, int $level [, int $encoding_mode ]] )
  15. * Description: Gzip-compress a string
  16. * Source code: ext/zlib/zlib.c
  17. * Alias to functions:
  18. */
  19. if(!function_exists("gzdecode")) {
  20. function gzdecode($data)
  21. {
  22. return gzinflate(substr($data,10,-8));
  23. }
  24. }
  25. include(dirname(__FILE__) . '/data.inc');
  26. echo "*** Testing gzencode() : variation ***\n";
  27. echo "\n-- Testing multiple compression --\n";
  28. $output = gzencode(gzencode($data));
  29. $back = gzdecode(gzdecode($output));
  30. var_dump($data === $back);
  31. ?>
  32. ===Done===
  33. --EXPECT--
  34. *** Testing gzencode() : variation ***
  35. -- Testing multiple compression --
  36. bool(true)
  37. ===Done===