Annotation of embedaddon/php/ext/standard/tests/strings/printf_basic1.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test printf() function : basic functionality - string 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 string format ***\n";
! 11:
! 12: // Initialise all required variables
! 13: $format = "format";
! 14: $format1 = "%s";
! 15: $format2 = "%s %s";
! 16: $format3 = "%s %s %s";
! 17: $arg1 = "arg1 argument";
! 18: $arg2 = "arg2 argument";
! 19: $arg3 = "arg3 argument";
! 20:
! 21: echo "\n-- Calling printf() with no arguments --\n";
! 22: $result = printf($format);
! 23: echo "\n";
! 24: var_dump($result);
! 25:
! 26: echo "\n-- Calling printf() with one arguments --\n";
! 27: $result = printf($format1, $arg1);
! 28: echo "\n";
! 29: var_dump($result);
! 30:
! 31: echo "\n-- Calling printf() with two arguments --\n";
! 32: $result = printf($format2, $arg1, $arg2);
! 33: echo "\n";
! 34: var_dump($result);
! 35:
! 36:
! 37: echo "\n-- Calling printf() with string 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 string format ***
! 46:
! 47: -- Calling printf() with no arguments --
! 48: format
! 49: int(6)
! 50:
! 51: -- Calling printf() with one arguments --
! 52: arg1 argument
! 53: int(13)
! 54:
! 55: -- Calling printf() with two arguments --
! 56: arg1 argument arg2 argument
! 57: int(27)
! 58:
! 59: -- Calling printf() with string three arguments --
! 60: arg1 argument arg2 argument arg3 argument
! 61: int(41)
! 62: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>