1--TEST-- 2Test sprintf() function : basic functionality - bool format 3--FILE-- 4<?php 5/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]]) 6 * Description: Return a formatted string 7 * Source code: ext/standard/formatted_print.c 8 */ 9 10echo "*** Testing sprintf() : basic functionality - using bool format ***\n"; 11 12 13// Initialise all required variables 14$format = "format"; 15$format1 = "%b"; 16$format2 = "%b %b"; 17$format3 = "%b %b %b"; 18$arg1 = TRUE; 19$arg2 = FALSE; 20$arg3 = true; 21 22// Calling sprintf() with default arguments 23var_dump( sprintf($format) ); 24 25// Calling sprintf() with two arguments 26var_dump( sprintf($format1, $arg1) ); 27 28// Calling sprintf() with three arguments 29var_dump( sprintf($format2, $arg1, $arg2) ); 30 31// Calling sprintf() with four arguments 32var_dump( sprintf($format3, $arg1, $arg2, $arg3) ); 33 34echo "Done"; 35?> 36--EXPECTF-- 37*** Testing sprintf() : basic functionality - using bool format *** 38string(6) "format" 39string(1) "1" 40string(3) "1 0" 41string(5) "1 0 1" 42Done 43