gzseek_variation2.phpt 853 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. --TEST--
  2. Test function gzseek() by calling it with SEEK_SET when reading
  3. --EXTENSIONS--
  4. zlib
  5. --FILE--
  6. <?php
  7. $f = __DIR__."/004.txt.gz";
  8. $h = gzopen($f, 'r');
  9. echo "move to the 50th byte\n";
  10. var_dump(gzseek( $h, 50, SEEK_SET ) );
  11. echo "tell=".gztell($h)."\n";
  12. //read the next 10
  13. var_dump(gzread($h, 10));
  14. echo "\nmove forward to the 100th byte\n";
  15. var_dump(gzseek( $h, 100, SEEK_SET ) );
  16. echo "tell=".gztell($h)."\n";
  17. //read the next 10
  18. var_dump(gzread($h, 10));
  19. echo "\nmove backward to the 20th byte\n";
  20. var_dump(gzseek( $h, 20, SEEK_SET ) );
  21. echo "tell=".gztell($h)."\n";
  22. //read the next 10
  23. var_dump(gzread($h, 10));
  24. gzclose($h);
  25. ?>
  26. --EXPECT--
  27. move to the 50th byte
  28. int(0)
  29. tell=50
  30. string(10) " high abov"
  31. move forward to the 100th byte
  32. int(0)
  33. tell=100
  34. string(10) "Destiny wh"
  35. move backward to the 20th byte
  36. int(0)
  37. tell=20
  38. string(10) "hrough fee"