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(null, true)); 10var_dump(uniqid(null, 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 null, 21 true, 22 false 23 ); 24 25for ($i = 0; $i < count($prefix); $i++) { 26 var_dump(uniqid($prefix[$i])); 27 var_dump(uniqid($prefix[$i], true)); 28 var_dump(uniqid($prefix[$i], false)); 29 echo "\n"; 30} 31 32?> 33--EXPECTF-- 34*** Testing uniqid() : basic functionality *** 35 36uniqid() without a prefix 37string(13) "%s" 38string(23) "%s.%s" 39string(13) "%s" 40 41 42uniqid() with a prefix 43string(18) "99999%s" 44string(28) "99999%s.%s" 45string(18) "99999%s" 46 47string(18) "99999%s" 48string(28) "99999%s.%s" 49string(18) "99999%s" 50 51string(17) "1050%s" 52string(27) "1050%s.%s" 53string(17) "1050%s" 54 55string(13) "%s" 56string(23) "%s.%s" 57string(13) "%s" 58 59string(14) "1%s" 60string(24) "1%s.%s" 61string(14) "1%s" 62 63string(13) "%s" 64string(23) "%s.%s" 65string(13) "%s" 66 67