1--TEST--
2sprintf %f
3--FILE--
4<?php
5
6var_dump(sprintf("%3.2f", 1.2));
7var_dump(sprintf("%-3.2f", 1.2));
8var_dump(sprintf("%03.2f", 1.2));
9var_dump(sprintf("%-03.2f", 1.2));
10echo "\n";
11var_dump(sprintf("%5.2f", 3.4));
12var_dump(sprintf("%-5.2f", 3.4));
13var_dump(sprintf("%05.2f", 3.4));
14var_dump(sprintf("%-05.2f", 3.4));
15echo "\n";
16var_dump(sprintf("%7.2f", -5.6));
17var_dump(sprintf("%-7.2f", -5.6));
18var_dump(sprintf("%07.2f", -5.6));
19var_dump(sprintf("%-07.2f", -5.6));
20echo "\n";
21var_dump(sprintf("%3.4f", 1.2345678e99));
22
23?>
24--EXPECTF--
25string(4) "1.20"
26string(4) "1.20"
27string(4) "1.20"
28string(4) "1.20"
29
30string(5) " 3.40"
31string(5) "3.40 "
32string(5) "03.40"
33string(5) "3.400"
34
35string(7) "  -5.60"
36string(7) "-5.60  "
37string(7) "-005.60"
38string(7) "-5.6000"
39
40string(105) "1234567%d.0000"
41