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

1.1       misho       1: --TEST--
                      2: Test printf() function : basic functionality - hexadecimal format
                      3: --FILE--
                      4: <?php
                      5: /* Prototype  : int printf  ( string $format  [, mixed $args  [, mixed $...  ]] )
                      6:  * Description: Produces output according to format .
                      7:  * Source code: ext/standard/formatted_print.c
                      8:  */
                      9: 
                     10: echo "*** Testing printf() : basic functionality - using hexadecimal format ***\n";
                     11: 
                     12: // Initialise all required variables
                     13: 
                     14: // Initialising different format strings
                     15: $format = "format";
                     16: $format1 = "%x";
                     17: $format2 = "%x %x";
                     18: $format3 = "%x %x %x";
                     19: 
                     20: $format11 = "%X";
                     21: $format22 = "%X %X";
                     22: $format33 = "%X %X %X";
                     23: 
                     24: $arg1 = 11;
                     25: $arg2 = 132;
                     26: $arg3 = 177;
                     27: 
                     28: echo "\n-- Calling printf() with no arguments --\n"; 
                     29: $result = printf($format);
                     30: echo "\n";
                     31: var_dump($result);
                     32: 
                     33: echo "\n-- Calling printf() with one arguments --\n"; 
                     34: $result = printf($format1, $arg1);
                     35: echo "\n";
                     36: var_dump($result);
                     37: $result = printf($format11, $arg1);
                     38: echo "\n";
                     39: var_dump($result);
                     40: 
                     41: echo "\n-- Calling printf() with two arguments --\n"; 
                     42: $result = printf($format2, $arg1, $arg2);
                     43: echo "\n";
                     44: var_dump($result);
                     45: $result = printf($format22, $arg1, $arg2);
                     46: echo "\n";
                     47: var_dump($result);
                     48: 
                     49: echo "\n-- Calling printf() with three arguments --\n"; 
                     50: $result = printf($format3, $arg1, $arg2, $arg3);
                     51: echo "\n";
                     52: var_dump($result);
                     53: $result = printf($format33, $arg1, $arg2, $arg3);
                     54: echo "\n";
                     55: var_dump($result);
                     56: 
                     57: ?>
                     58: ===DONE===
                     59: --EXPECTF--
                     60: *** Testing printf() : basic functionality - using hexadecimal format ***
                     61: 
                     62: -- Calling printf() with no arguments --
                     63: format
                     64: int(6)
                     65: 
                     66: -- Calling printf() with one arguments --
                     67: b
                     68: int(1)
                     69: B
                     70: int(1)
                     71: 
                     72: -- Calling printf() with two arguments --
                     73: b 84
                     74: int(4)
                     75: B 84
                     76: int(4)
                     77: 
                     78: -- Calling printf() with three arguments --
                     79: b 84 b1
                     80: int(7)
                     81: B 84 B1
                     82: int(7)
                     83: ===DONE===

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