import zend standard tests
[hiphop-php.git] / hphp / test / zend / good / ext-standard-strings / sprintf_basic9.php
blob7e6df4108cc19d4c3e85ae1dd9716d7a5c9ce49c
1 <?php
2 /* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
3 * Description: Return a formatted string
4 * Source code: ext/standard/formatted_print.c
5 */
7 echo "*** Testing sprintf() : basic functionality - using hexadecimal format ***\n";
9 // Initialise all required variables
11 // Initialising different format strings
12 $format = "format";
13 $format1 = "%x";
14 $format2 = "%x %x";
15 $format3 = "%x %x %x";
17 $format11 = "%X";
18 $format22 = "%X %X";
19 $format33 = "%X %X %X";
21 $arg1 = 11;
22 $arg2 = 132;
23 $arg3 = 177;
25 // Calling sprintf() with default arguments
26 var_dump( sprintf($format) );
28 // Calling sprintf() with two arguments
29 var_dump( sprintf($format1, $arg1) );
30 var_dump( sprintf($format11, $arg1) );
32 // Calling sprintf() with three arguments
33 var_dump( sprintf($format2, $arg1, $arg2) );
34 var_dump( sprintf($format22, $arg1, $arg2) );
36 // Calling sprintf() with four arguments
37 var_dump( sprintf($format3, $arg1, $arg2, $arg3) );
38 var_dump( sprintf($format33, $arg1, $arg2, $arg3) );
40 echo "Done";