1--TEST--
2Test sprintf() function : basic functionality - unsigned format
3--SKIPIF--
4<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?>
5--FILE--
6<?php
7/* Prototype  : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
8 * Description: Return a formatted string
9 * Source code: ext/standard/formatted_print.c
10 */
11
12echo "*** Testing sprintf() : basic functionality - using unsigned format ***\n";
13
14
15// Initialise all required variables
16$format = "format";
17$format1 = "%u";
18$format2 = "%u %u";
19$format3 = "%u %u %u";
20$arg1 = -1111;
21$arg2 = -1234567;
22$arg3 = +2345432;
23
24// Calling sprintf() with default arguments
25var_dump( sprintf($format) );
26
27// Calling sprintf() with two arguments
28var_dump( sprintf($format1, $arg1) );
29
30// Calling sprintf() with three arguments
31var_dump( sprintf($format2, $arg1, $arg2) );
32
33// Calling sprintf() with four arguments
34var_dump( sprintf($format3, $arg1, $arg2, $arg3) );
35
36echo "Done";
37?>
38--EXPECTF--
39*** Testing sprintf() : basic functionality - using unsigned format ***
40string(6) "format"
41string(20) "18446744073709550505"
42string(41) "18446744073709550505 18446744073708317049"
43string(49) "18446744073709550505 18446744073708317049 2345432"
44Done
45