Annotation of embedaddon/php/ext/standard/tests/strings/sprintf_basic6.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test sprintf() function : basic functionality - exponential 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 exponential format ***\n";
11:
12: // Initialise all required variables
13: $format = "format";
14: $format1 = "%e";
15: $format2 = "%E %e";
16: $format3 = "%e %E %e";
17: $arg1 = 1000;
18: $arg2 = 2e3;
19: $arg3 = +3e3;
20:
21: // Calling sprintf() with default arguments
22: var_dump( sprintf($format) );
23:
24: // Calling sprintf() with two arguments
25: var_dump( sprintf($format1, $arg1) );
26:
27: // Calling sprintf() with three arguments
28: var_dump( sprintf($format2, $arg1, $arg2) );
29:
30: // Calling sprintf() with four arguments
31: var_dump( sprintf($format3, $arg1, $arg2, $arg3) );
32:
33: echo "Done";
34: ?>
35: --EXPECTF--
36: *** Testing sprintf() : basic functionality - using exponential format ***
37: string(6) "format"
38: string(11) "1.000000e+3"
39: string(23) "1.000000E+3 2.000000e+3"
40: string(35) "1.000000e+3 2.000000E+3 3.000000e+3"
41: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>