gzencode_variation2-win32.phpt 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. --TEST--
  2. Test gzencode() function : variation - verify header contents with all encoding modes
  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. echo "*** Testing gzencode() : variation ***\n";
  20. $data = "A small string to encode\n";
  21. echo "\n-- Testing with each encoding_mode --\n";
  22. var_dump(bin2hex(gzencode($data, -1)));
  23. var_dump(bin2hex(gzencode($data, -1, FORCE_GZIP)));
  24. var_dump(bin2hex(gzencode($data, -1, FORCE_DEFLATE)));
  25. ?>
  26. ===DONE===
  27. --EXPECTF--
  28. *** Testing gzencode() : variation ***
  29. -- Testing with each encoding_mode --
  30. string(90) "1f8b080000000000000b735428ce4dccc951282e29cacc4b5728c95748cd4bce4f49e50200d7739de519000000"
  31. string(90) "1f8b080000000000000b735428ce4dccc951282e29cacc4b5728c95748cd4bce4f49e50200d7739de519000000"
  32. string(66) "789c735428ce4dccc951282e29cacc4b5728c95748cd4bce4f49e50200735808cd"
  33. ===DONE===