gzread_basic.phpt 751 B

12345678910111213141516171819202122232425262728293031323334353637
  1. --TEST--
  2. Test function gzread() by calling it with its expected arguments
  3. --SKIPIF--
  4. <?php
  5. if (!extension_loaded("zlib")) {
  6. print "skip - ZLIB extension not loaded";
  7. }
  8. ?>
  9. --FILE--
  10. <?php
  11. // note that gzread is an alias to fread. parameter checking tests will be
  12. // the same as fread
  13. $f = dirname(__FILE__)."/004.txt.gz";
  14. $h = gzopen($f, 'r');
  15. $lengths = array(10, 14, 7, 99, 2000);
  16. foreach ($lengths as $length) {
  17. var_dump(gzread( $h, $length ) );
  18. }
  19. gzclose($h);
  20. ?>
  21. ===DONE===
  22. --EXPECT--
  23. string(10) "When you'r"
  24. string(14) "e taught throu"
  25. string(7) "gh feel"
  26. string(99) "ings
  27. Destiny flying high above
  28. all I know is that you can realize it
  29. Destiny who cares
  30. as it turns "
  31. string(46) "around
  32. and I know that it descends down on me
  33. "
  34. ===DONE===