Annotation of embedaddon/php/ext/standard/tests/strings/sprintf_basic2.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test sprintf() function : basic functionality - integer 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: 
                     10: echo "*** Testing sprintf() : basic functionality - using integer format ***\n";
                     11: 
                     12: 
                     13: // Initialise all required variables
                     14: $format = "format";
                     15: $format1 = "%d";
                     16: $format2 = "%d %d";
                     17: $format3 = "%d %d %d";
                     18: $arg1 = 111;
                     19: $arg2 = 222;
                     20: $arg3 = 333;
                     21: 
                     22: // Calling sprintf() with default arguments
                     23: var_dump( sprintf($format) );
                     24: 
                     25: // Calling sprintf() with two arguments
                     26: var_dump( sprintf($format1, $arg1) );
                     27: 
                     28: // Calling sprintf() with three arguments
                     29: var_dump( sprintf($format2, $arg1, $arg2) );
                     30: 
                     31: // Calling sprintf() with four arguments
                     32: var_dump( sprintf($format3, $arg1, $arg2, $arg3) );
                     33: 
                     34: echo "Done";
                     35: ?>
                     36: --EXPECTF--
                     37: *** Testing sprintf() : basic functionality - using integer format ***
                     38: string(6) "format"
                     39: string(3) "111"
                     40: string(7) "111 222"
                     41: string(11) "111 222 333"
                     42: Done

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>