Annotation of embedaddon/php/ext/standard/tests/strings/vsprintf_basic9.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test 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:
10: echo "*** 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:
26: var_dump( vsprintf($format1,$arg1) );
27: var_dump( vsprintf($format11,$arg1) );
28:
29: var_dump( vsprintf($format2,$arg2) );
30: var_dump( vsprintf($format22,$arg2) );
31:
32: var_dump( vsprintf($format3,$arg3) );
33: var_dump( vsprintf($format33,$arg3) );
34:
35: echo "Done";
36: ?>
37: --EXPECTF--
38: *** Testing vsprintf() : basic functionality - using hexadecimal format ***
39: string(1) "b"
40: string(1) "B"
41: string(4) "b 84"
42: string(4) "B 84"
43: string(7) "b 84 b1"
44: string(7) "B 84 B1"
45: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>