1--TEST--
2Test uniqid() function : basic functionality
3--FILE--
4<?php
5echo "*** Testing uniqid() : basic functionality ***\n";
6
7echo "\nuniqid() without a prefix\n";
8var_dump(uniqid());
9var_dump(uniqid('', true));
10var_dump(uniqid('', false));
11echo "\n\n";
12
13echo "uniqid() with a prefix\n";
14
15// Use a fixed prefix so we can ensure length of o/p id is fixed
16$prefix = array (
17                99999,
18                "99999",
19                10.5e2,
20                true,
21                false
22                );
23
24for ($i = 0; $i < count($prefix); $i++) {
25    var_dump(uniqid($prefix[$i]));
26    var_dump(uniqid($prefix[$i], true));
27    var_dump(uniqid($prefix[$i], false));
28    echo "\n";
29}
30
31?>
32--EXPECTF--
33*** Testing uniqid() : basic functionality ***
34
35uniqid() without a prefix
36string(13) "%s"
37string(23) "%s.%s"
38string(13) "%s"
39
40
41uniqid() with a prefix
42string(18) "99999%s"
43string(28) "99999%s.%s"
44string(18) "99999%s"
45
46string(18) "99999%s"
47string(28) "99999%s.%s"
48string(18) "99999%s"
49
50string(17) "1050%s"
51string(27) "1050%s.%s"
52string(17) "1050%s"
53
54string(14) "1%s"
55string(24) "1%s.%s"
56string(14) "1%s"
57
58string(13) "%s"
59string(23) "%s.%s"
60string(13) "%s"
61