Annotation of embedaddon/php/ext/standard/tests/strings/printf_basic2.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test printf() function : basic functionality - integer 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 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: echo "\n-- Calling printf() with no arguments --\n";
! 23: $result = printf($format);
! 24: echo "\n";
! 25: var_dump($result);
! 26:
! 27: echo "\n-- Calling printf() with one arguments--\n";
! 28: $result = printf($format1, $arg1);
! 29: echo "\n";
! 30: var_dump($result);
! 31:
! 32: echo "\n-- Calling printf() with two arguments--\n";
! 33: $result = printf($format2, $arg1, $arg2);
! 34: echo "\n";
! 35: var_dump($result);
! 36:
! 37: echo "\n-- Calling printf() with three arguments--\n";
! 38: $result = printf($format3, $arg1, $arg2, $arg3);
! 39: echo "\n";
! 40: var_dump($result);
! 41:
! 42: ?>
! 43: ===DONE===
! 44: --EXPECTF--
! 45: *** Testing printf() : basic functionality - using integer format ***
! 46:
! 47: -- Calling printf() with no arguments --
! 48: format
! 49: int(6)
! 50:
! 51: -- Calling printf() with one arguments--
! 52: 111
! 53: int(3)
! 54:
! 55: -- Calling printf() with two arguments--
! 56: 111 222
! 57: int(7)
! 58:
! 59: -- Calling printf() with three arguments--
! 60: 111 222 333
! 61: int(11)
! 62: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>