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