gzseek_basic.phpt 949 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. --TEST--
  2. Test function gzseek() by calling it with its expected arguments when reading
  3. --SKIPIF--
  4. <?php
  5. if (!extension_loaded("zlib")) {
  6. print "skip - ZLIB extension not loaded";
  7. }
  8. ?>
  9. --FILE--
  10. <?php
  11. $f = dirname(__FILE__)."/004.txt.gz";
  12. $h = gzopen($f, 'r');
  13. echo "move to the 50th byte\n";
  14. var_dump(gzseek( $h, 50 ) );
  15. echo "tell=".gztell($h)."\n";
  16. //read the next 10
  17. var_dump(gzread($h, 10));
  18. echo "\nmove forward to the 100th byte\n";
  19. var_dump(gzseek( $h, 100 ) );
  20. echo "tell=".gztell($h)."\n";
  21. //read the next 10
  22. var_dump(gzread($h, 10));
  23. echo "\nmove backward to the 20th byte\n";
  24. var_dump(gzseek( $h, 20 ) );
  25. echo "tell=".gztell($h)."\n";
  26. //read the next 10
  27. var_dump(gzread($h, 10));
  28. gzclose($h);
  29. ?>
  30. ===DONE===
  31. --EXPECT--
  32. move to the 50th byte
  33. int(0)
  34. tell=50
  35. string(10) " high abov"
  36. move forward to the 100th byte
  37. int(0)
  38. tell=100
  39. string(10) "Destiny wh"
  40. move backward to the 20th byte
  41. int(0)
  42. tell=20
  43. string(10) "hrough fee"
  44. ===DONE===