1--TEST--
2Test sprintf() function : basic functionality - string format
3--FILE--
4<?php
5echo "*** Testing sprintf() : 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
16// Calling sprintf() with default arguments
17var_dump( sprintf($format) );
18
19// Calling sprintf() with two arguments
20var_dump( sprintf($format1, $arg1) );
21
22// Calling sprintf() with three arguments
23var_dump( sprintf($format2, $arg1, $arg2) );
24
25// Calling sprintf() with four arguments
26var_dump( sprintf($format3, $arg1, $arg2, $arg3) );
27
28echo "Done";
29?>
30--EXPECT--
31*** Testing sprintf() : basic functionality - using string format ***
32string(6) "format"
33string(13) "arg1 argument"
34string(27) "arg1 argument arg2 argument"
35string(41) "arg1 argument arg2 argument arg3 argument"
36Done
37