1--TEST-- 2gzopen(), gzread(), gzwrite() 3--SKIPIF-- 4<?php # vim600:syn=php: 5if (!extension_loaded("zlib")) print "skip"; ?> 6--FILE-- 7<?php 8$original = str_repeat("hallo php",4096); 9$filename = tempnam(sys_get_temp_dir(), "phpt"); 10 11$fp = gzopen($filename, "wb"); 12gzwrite($fp, $original); 13var_dump(strlen($original)); 14var_dump(gztell($fp)); 15fclose($fp); 16 17$fp = gzopen($filename, "rb"); 18 19$data = ''; 20while ($buf = gzread($fp, 8092)) { 21 $data .= $buf; 22} 23 24if ($data == $original) { 25 echo "Strings are equal\n"; 26} else { 27 echo "Strings are not equal\n"; 28 var_dump($data); 29} 30gzclose($fp); 31unlink($filename); 32?> 33--EXPECT-- 34int(36864) 35int(36864) 36Strings are equal 37