1--TEST-- 2Test incremental deflate_init() context reuse 3--SKIPIF-- 4<?php 5if (!extension_loaded("zlib")) { 6 print "skip - ZLIB extension not loaded"; 7} 8?> 9--FILE-- 10<?php 11$resource = deflate_init(ZLIB_ENCODING_DEFLATE); 12foreach (range("a", "z") as $char) { 13 deflate_add($resource, $char); 14} 15deflate_add($resource, "", ZLIB_FINISH); 16 17// Now reuse the existing resource after finishing the previous operations ... 18$uncompressed = $compressed = ""; 19foreach (range("a", "z") as $char) { 20 $uncompressed .= $char; 21 $compressed .= deflate_add($resource, $char, ZLIB_NO_FLUSH); 22} 23$compressed .= deflate_add($resource, "", ZLIB_FINISH); 24assert($uncompressed === zlib_decode($compressed)); 25?> 26===DONE=== 27--EXPECTF-- 28===DONE=== 29