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.. Do not run on Windows"); 8} 9 10if (!extension_loaded("zlib")) { 11 print "skip - ZLIB extension not loaded"; 12} 13 14if (PHP_OS == "Darwin") { 15 print "skip - OS is encoded in headers, tested header is non Darwin"; 16} 17?> 18--FILE-- 19<?php 20/* Prototype : string gzencode ( string $data [, int $level [, int $encoding_mode ]] ) 21 * Description: Gzip-compress a string 22 * Source code: ext/zlib/zlib.c 23 * Alias to functions: 24 */ 25 26echo "*** Testing gzencode() : variation ***\n"; 27 28$data = "A small string to encode\n"; 29 30echo "\n-- Testing with each encoding_mode --\n"; 31var_dump(bin2hex(gzencode($data, -1))); 32var_dump(bin2hex(gzencode($data, -1, FORCE_GZIP))); 33var_dump(bin2hex(gzencode($data, -1, FORCE_DEFLATE))); 34 35?> 36===DONE=== 37--EXPECT-- 38*** Testing gzencode() : variation *** 39 40-- Testing with each encoding_mode -- 41string(90) "1f8b0800000000000003735428ce4dccc951282e29cacc4b5728c95748cd4bce4f49e50200d7739de519000000" 42string(90) "1f8b0800000000000003735428ce4dccc951282e29cacc4b5728c95748cd4bce4f49e50200d7739de519000000" 43string(66) "789c735428ce4dccc951282e29cacc4b5728c95748cd4bce4f49e50200735808cd" 44===DONE=== 45