1--TEST-- 2Test gzencode() function : variation - verify header contents with all encoding modes 3--SKIPIF-- 4<?php 5 6if( substr(PHP_OS, 0, 3) != "WIN" ) { 7 die("skip.. only for Windows"); 8} 9 10if (!extension_loaded("zlib")) { 11 print "skip - ZLIB extension not loaded"; 12} 13 14include 'func.inc'; 15if (version_compare(get_zlib_version(), "1.2.11") < 0) { 16 die("skip - at least zlib 1.2.11 required, got " . get_zlib_version()); 17} 18?> 19--FILE-- 20<?php 21/* Prototype : string gzencode ( string $data [, int $level [, int $encoding_mode ]] ) 22 * Description: Gzip-compress a string 23 * Source code: ext/zlib/zlib.c 24 * Alias to functions: 25 */ 26 27echo "*** Testing gzencode() : variation ***\n"; 28 29$data = "A small string to encode\n"; 30 31echo "\n-- Testing with each encoding_mode --\n"; 32var_dump(bin2hex(gzencode($data, -1))); 33var_dump(bin2hex(gzencode($data, -1, FORCE_GZIP))); 34var_dump(bin2hex(gzencode($data, -1, FORCE_DEFLATE))); 35 36?> 37===DONE=== 38--EXPECT-- 39*** Testing gzencode() : variation *** 40 41-- Testing with each encoding_mode -- 42string(90) "1f8b080000000000000a735428ce4dccc951282e29cacc4b5728c95748cd4bce4f49e50200d7739de519000000" 43string(90) "1f8b080000000000000a735428ce4dccc951282e29cacc4b5728c95748cd4bce4f49e50200d7739de519000000" 44string(66) "789c735428ce4dccc951282e29cacc4b5728c95748cd4bce4f49e50200735808cd" 45===DONE=== 46