1--TEST-- 2Test sprintf() function : basic functionality - char format 3--FILE-- 4<?php 5echo "*** Testing sprintf() : basic functionality - using char format ***\n"; 6 7 8// Initialise all required variables 9$format = "format"; 10$format1 = "%c"; 11$format2 = "%c %c"; 12$format3 = "%c %c %c"; 13$arg1 = 65; 14$arg2 = 66; 15$arg3 = 67; 16 17// Calling sprintf() with default arguments 18var_dump( sprintf($format) ); 19 20// Calling sprintf() with two arguments 21var_dump( sprintf($format1, $arg1) ); 22 23// Calling sprintf() with three arguments 24var_dump( sprintf($format2, $arg1, $arg2) ); 25 26// Calling sprintf() with four arguments 27var_dump( sprintf($format3, $arg1, $arg2, $arg3) ); 28 29echo "Done"; 30?> 31--EXPECT-- 32*** Testing sprintf() : basic functionality - using char format *** 33string(6) "format" 34string(1) "A" 35string(3) "A B" 36string(5) "A B C" 37Done 38