gzgetc_basic_1.phpt 862 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. --TEST--
  2. Test function gzgetc() by calling it with its expected arguments zlib 1.2.7
  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.7') < 0) {
  10. die('skip - only for zlib >= 1.2.7');
  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. if ($h) {
  20. $count = 0;
  21. while (($c = fgetc( $h )) !== false) {
  22. $count++;
  23. echo $c;
  24. }
  25. echo "\ncharacters counted=$count\n";
  26. gzclose($h);
  27. }
  28. ?>
  29. ===DONE===
  30. --EXPECT--
  31. When you're taught through feelings
  32. Destiny flying high above
  33. all I know is that you can realize it
  34. Destiny who cares
  35. as it turns around
  36. and I know that it descends down on me
  37. characters counted=176
  38. ===DONE===