2 /* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
3 * Description: Return a formatted string
4 * Source code: ext/standard/formatted_print.c
7 echo "*** Testing sprintf() : char formats with array values ***\n";
9 // array of array values
10 $array_values = array(
22 array(1 => "One", "two" => 2)
25 // array of char formats
26 $char_formats = array(
29 "\t%c", "\n%c", "%4c",
30 "%30c", "%[a-bA-B@#$&]", "%*c"
34 foreach($array_values as $array_value) {
35 echo "\n-- Iteration $count --\n";
37 foreach($char_formats as $format) {
38 var_dump( sprintf($format, $array_value) );