gzseek_variation3.phpt 850 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. --TEST--
  2. Test function gzseek() by calling it with SEEK_CUR 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_CUR ) );
  11. echo "tell=".gztell($h)."\n";
  12. //read the next 10
  13. var_dump(gzread($h, 10));
  14. echo "\nmove forward to the 94th byte\n";
  15. var_dump(gzseek( $h, 34, SEEK_CUR ) );
  16. echo "tell=".gztell($h)."\n";
  17. //read the next 10
  18. var_dump(gzread($h, 10));
  19. echo "\nmove backward to the 77th byte\n";
  20. var_dump(gzseek( $h, -27, SEEK_CUR ) );
  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 94th byte
  32. int(0)
  33. tell=94
  34. string(10) "ze it
  35. Dest"
  36. move backward to the 77th byte
  37. int(0)
  38. tell=77
  39. string(10) "hat you ca"