1--TEST--
2Test printf() function : basic functionality - string format
3--FILE--
4<?php
5echo "*** Testing printf() : basic functionality - using string format ***\n";
6
7// Initialise all required variables
8$format = "format";
9$format1 = "%s";
10$format2 = "%s %s";
11$format3 = "%s %s %s";
12$arg1 = "arg1 argument";
13$arg2 = "arg2 argument";
14$arg3 = "arg3 argument";
15
16echo "\n-- Calling printf() with no arguments --\n";
17$result = printf($format);
18echo "\n";
19var_dump($result);
20
21echo "\n-- Calling printf() with one arguments --\n";
22$result = printf($format1, $arg1);
23echo "\n";
24var_dump($result);
25
26echo "\n-- Calling printf() with two arguments --\n";
27$result = printf($format2, $arg1, $arg2);
28echo "\n";
29var_dump($result);
30
31
32echo "\n-- Calling printf() with string three arguments --\n";
33$result = printf($format3, $arg1, $arg2, $arg3);
34echo "\n";
35var_dump($result);
36
37?>
38--EXPECT--
39*** Testing printf() : basic functionality - using string format ***
40
41-- Calling printf() with no arguments --
42format
43int(6)
44
45-- Calling printf() with one arguments --
46arg1 argument
47int(13)
48
49-- Calling printf() with two arguments --
50arg1 argument arg2 argument
51int(27)
52
53-- Calling printf() with string three arguments --
54arg1 argument arg2 argument arg3 argument
55int(41)
56