1--TEST-- 2inflate_get_read_len() 3--EXTENSIONS-- 4zlib 5--FILE-- 6<?php 7 8$uncompressed = "Hello world."; 9$random_junk = str_repeat("qebsouesl", 128); 10 11$compressed = zlib_encode($uncompressed, ZLIB_ENCODING_DEFLATE); 12$compressed_len = strlen($compressed); 13$compressed .= $random_junk; 14 15$ctx = inflate_init(ZLIB_ENCODING_DEFLATE); 16$buf = inflate_add($ctx, $compressed); 17$detected_compressed_len = inflate_get_read_len($ctx); 18 19echo 'Status: ' . inflate_get_status($ctx) . "\n"; 20echo 'Original compressed length: ' . $compressed_len . "\n"; 21echo 'Detected compressed length: ' . $detected_compressed_len . "\n"; 22 23echo ($compressed_len == $detected_compressed_len) ? 'The lengths are equal.' : 'The lengths are unequal.'; 24?> 25--EXPECT-- 26Status: 1 27Original compressed length: 20 28Detected compressed length: 20 29The lengths are equal. 30