1--TEST-- 2Test printf() function : basic functionality - char format 3--FILE-- 4<?php 5echo "*** Testing printf() : 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 17echo "\n-- Calling printf() with no arguments --\n"; 18$result = printf($format); 19echo "\n"; 20var_dump($result); 21 22echo "\n-- Calling printf() with one arguments --\n"; 23$result = printf($format1, $arg1); 24echo "\n"; 25var_dump($result); 26 27echo "\n-- Calling printf() with two arguments --\n"; 28$result = printf($format2, $arg1, $arg2); 29echo "\n"; 30var_dump($result); 31 32echo "\n-- Calling printf() with three arguments --\n"; 33$result = printf($format3, $arg1, $arg2, $arg3); 34echo "\n"; 35var_dump($result); 36?> 37--EXPECT-- 38*** Testing printf() : basic functionality - using char format *** 39 40-- Calling printf() with no arguments -- 41format 42int(6) 43 44-- Calling printf() with one arguments -- 45A 46int(1) 47 48-- Calling printf() with two arguments -- 49A B 50int(3) 51 52-- Calling printf() with three arguments -- 53A B C 54int(5) 55