gzgetc_basic.phpt 842 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. --TEST--
  2. Test function gzgetc() by calling it with its expected arguments zlib 1.2.5
  3. --SKIPIF--
  4. <?php
  5. if (!extension_loaded("zlib")) {
  6. print "skip - ZLIB extension not loaded";
  7. }
  8. include 'func.inc';
  9. if (version_compare(get_zlib_version(), '1.2.5') > 0) {
  10. die('skip - only for zlib <= 1.2.5');
  11. }
  12. ?>
  13. --FILE--
  14. <?php
  15. // note that gzgets is an alias to fgets. parameter checking tests will be
  16. // the same as gzgets
  17. $f = dirname(__FILE__)."/004.txt.gz";
  18. $h = gzopen($f, 'r');
  19. $count = 0;
  20. while (gzeof($h) === false) {
  21. $count++;
  22. echo fgetc( $h );
  23. }
  24. echo "\ncharacters counted=$count\n";
  25. gzclose($h);
  26. ?>
  27. ===DONE===
  28. --EXPECT--
  29. When you're taught through feelings
  30. Destiny flying high above
  31. all I know is that you can realize it
  32. Destiny who cares
  33. as it turns around
  34. and I know that it descends down on me
  35. characters counted=176
  36. ===DONE===