xref: /PHP-7.4/ext/zlib/tests/gzgetc_basic_1.phpt (revision 26dfce7f)
1--TEST--
2Test function gzgetc() by calling it with its expected arguments zlib 1.2.7
3--SKIPIF--
4<?php
5if (!extension_loaded("zlib")) {
6	print "skip - ZLIB extension not loaded";
7}
8include 'func.inc';
9if (version_compare(get_zlib_version(), '1.2.7') < 0) {
10	die('skip - only for zlib >= 1.2.7');
11}
12?>
13--FILE--
14<?php
15
16// note that gzgets is an alias to fgets. parameter checking tests will be
17// the same as gzgets
18
19$f = __DIR__."/004.txt.gz";
20$h = gzopen($f, 'r');
21if ($h) {
22	$count = 0;
23	while (($c = fgetc( $h )) !== false) {
24	   $count++;
25	   echo $c;
26	}
27
28	echo "\ncharacters counted=$count\n";
29	gzclose($h);
30}
31
32?>
33===DONE===
34--EXPECT--
35When you're taught through feelings
36Destiny flying high above
37all I know is that you can realize it
38Destiny who cares
39as it turns around
40and I know that it descends down on me
41
42characters counted=176
43===DONE===
44