1--TEST--
2Test printf() function : basic functionality - char format
3--FILE--
4<?php
5/* Prototype  : int printf  ( string $format  [, mixed $args  [, mixed $...  ]] )
6 * Description: Produces output according to format .
7 * Source code: ext/standard/formatted_print.c
8 */
9
10echo "*** Testing printf() : basic functionality - using char format ***\n";
11
12
13// Initialise all required variables
14$format = "format";
15$format1 = "%c";
16$format2 = "%c %c";
17$format3 = "%c %c %c";
18$arg1 = 65;
19$arg2 = 66;
20$arg3 = 67;
21
22echo "\n-- Calling printf() with no arguments --\n";
23$result = printf($format);
24echo "\n";
25var_dump($result);
26
27echo "\n-- Calling printf() with one arguments --\n";
28$result = printf($format1, $arg1);
29echo "\n";
30var_dump($result);
31
32echo "\n-- Calling printf() with two arguments --\n";
33$result = printf($format2, $arg1, $arg2);
34echo "\n";
35var_dump($result);
36
37echo "\n-- Calling printf() with three arguments --\n";
38$result = printf($format3, $arg1, $arg2, $arg3);
39echo "\n";
40var_dump($result);
41?>
42===DONE===
43--EXPECTF--
44*** Testing printf() : basic functionality - using char format ***
45
46-- Calling printf() with no arguments --
47format
48int(6)
49
50-- Calling printf() with one arguments --
51A
52int(1)
53
54-- Calling printf() with two arguments --
55A B
56int(3)
57
58-- Calling printf() with three arguments --
59A B C
60int(5)
61===DONE===