1--TEST--
2Test printf() function : basic functionality - float 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
10echo "*** Testing printf() : basic functionality - using float format ***\n";
11
12
13// Initialise all required variables
14
15$format = "format";
16$format1 = "%f";
17$format2 = "%f %f";
18$format3 = "%f %f %f";
19
20$format11 = "%F";
21$format22 = "%F %F";
22$format33 = "%F %F %F";
23$arg1 = 11.11;
24$arg2 = 22.22;
25$arg3 = 33.33;
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$result = printf($format11, $arg1);
37echo "\n";
38var_dump($result);
39
40echo "\n-- Calling printf() with two arguments--\n";
41$result = printf($format2, $arg1, $arg2);
42echo "\n";
43var_dump($result);
44$result = printf($format22, $arg1, $arg2);
45echo "\n";
46var_dump($result);
47
48echo "\n-- Calling printf() with three arguments--\n";
49$result = printf($format3, $arg1, $arg2, $arg3);
50echo "\n";
51var_dump($result);
52$result = printf($format33, $arg1, $arg2, $arg3);
53echo "\n";
54var_dump($result);
55
56?>
57===DONE===
58--EXPECTF--
59*** Testing printf() : basic functionality - using float format ***
60
61-- Calling printf() with no arguments--
62format
63int(6)
64
65-- Calling printf() with one arguments--
6611.110000
67int(9)
6811.110000
69int(9)
70
71-- Calling printf() with two arguments--
7211.110000 22.220000
73int(19)
7411.110000 22.220000
75int(19)
76
77-- Calling printf() with three arguments--
7811.110000 22.220000 33.330000
79int(29)
8011.110000 22.220000 33.330000
81int(29)
82===DONE===