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