1--TEST-- 2Test vsprintf() function : basic functionality - hexadecimal format 3--FILE-- 4<?php 5/* Prototype : string vsprintf(string $format , array $args) 6 * Description: Return a formatted string 7 * Source code: ext/standard/formatted_print.c 8*/ 9 10echo "*** Testing vsprintf() : basic functionality - using hexadecimal format ***\n"; 11 12// Initialising different format strings 13$format = "format"; 14$format1 = "%x"; 15$format2 = "%x %x"; 16$format3 = "%x %x %x"; 17 18$format11 = "%X"; 19$format22 = "%X %X"; 20$format33 = "%X %X %X"; 21 22$arg1 = array(11); 23$arg2 = array(11,132); 24$arg3 = array(11,132,177); 25 26var_dump( vsprintf($format1,$arg1) ); 27var_dump( vsprintf($format11,$arg1) ); 28 29var_dump( vsprintf($format2,$arg2) ); 30var_dump( vsprintf($format22,$arg2) ); 31 32var_dump( vsprintf($format3,$arg3) ); 33var_dump( vsprintf($format33,$arg3) ); 34 35echo "Done"; 36?> 37--EXPECT-- 38*** Testing vsprintf() : basic functionality - using hexadecimal format *** 39string(1) "b" 40string(1) "B" 41string(4) "b 84" 42string(4) "B 84" 43string(7) "b 84 b1" 44string(7) "B 84 B1" 45Done 46