1--TEST--
2Test printf() function : basic functionality - hexadecimal format
3--FILE--
4<?php
5echo "*** Testing printf() : basic functionality - using hexadecimal format ***\n";
6
7// Initialise all required variables
8
9// Initialising different format strings
10$format = "format";
11$format1 = "%x";
12$format2 = "%x %x";
13$format3 = "%x %x %x";
14
15$format11 = "%X";
16$format22 = "%X %X";
17$format33 = "%X %X %X";
18
19$arg1 = 11;
20$arg2 = 132;
21$arg3 = 177;
22
23echo "\n-- Calling printf() with no arguments --\n";
24$result = printf($format);
25echo "\n";
26var_dump($result);
27
28echo "\n-- Calling printf() with one arguments --\n";
29$result = printf($format1, $arg1);
30echo "\n";
31var_dump($result);
32$result = printf($format11, $arg1);
33echo "\n";
34var_dump($result);
35
36echo "\n-- Calling printf() with two arguments --\n";
37$result = printf($format2, $arg1, $arg2);
38echo "\n";
39var_dump($result);
40$result = printf($format22, $arg1, $arg2);
41echo "\n";
42var_dump($result);
43
44echo "\n-- Calling printf() with three arguments --\n";
45$result = printf($format3, $arg1, $arg2, $arg3);
46echo "\n";
47var_dump($result);
48$result = printf($format33, $arg1, $arg2, $arg3);
49echo "\n";
50var_dump($result);
51
52?>
53--EXPECT--
54*** Testing printf() : basic functionality - using hexadecimal format ***
55
56-- Calling printf() with no arguments --
57format
58int(6)
59
60-- Calling printf() with one arguments --
61b
62int(1)
63B
64int(1)
65
66-- Calling printf() with two arguments --
67b 84
68int(4)
69B 84
70int(4)
71
72-- Calling printf() with three arguments --
73b 84 b1
74int(7)
75B 84 B1
76int(7)
77