1--TEST--
2Test printf() 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  : int printf  ( string $format  [, mixed $args  [, mixed $...  ]] )
12 * Description: Produces output according to format .
13 * Source code: ext/standard/formatted_print.c
14 */
15
16echo "*** Testing printf() : 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 = 05678;
26
27echo "\n-- Calling printf() with no arguments --\n";
28$result = printf($format);
29echo "\n";
30var_dump($result);
31
32echo "\n-- Calling printf() with one arguments --\n";
33$result = printf($format1, $arg1);
34echo "\n";
35var_dump($result);
36
37echo "\n-- Calling printf() with two arguments --\n";
38$result = printf($format2, $arg1, $arg2);
39echo "\n";
40var_dump($result);
41
42echo "\n-- Calling printf() with three arguments --\n";
43$result = printf($format3, $arg1, $arg2, $arg3);
44echo "\n";
45var_dump($result);
46
47?>
48===DONE===
49--EXPECTF--
50*** Testing printf() : basic functionality - using octal format ***
51
52-- Calling printf() with no arguments --
53format
54int(6)
55
56-- Calling printf() with one arguments --
5721
58int(2)
59
60-- Calling printf() with two arguments --
6121 37777777431
62int(14)
63
64-- Calling printf() with three arguments --
6521 37777777431 567
66int(18)
67===DONE===
68