I can not confirm this behavior:
php -r 'for($i = 0; $i < 1000; $i++) print strlen(uniqid("", true)) . "\n";'
Tested on OS X and Ubuntu with PHP 5.3.x gives 23 on each iteration.
What version of os / PHP are you using?
As the OP pointed out in the comments on his question: prefix exclusion should fix the problem;)
To develop a little more, you can look at the PHP source code: https://svn.php.net/viewvc/php/php-src/tags/php_5_3_8/ext/standard/uniqid.c?view=markup on line 79:
spprintf(&uniqid, 0, "%s%08x%05x%.8F", prefix, sec, usec, php_combined_lcg(TSRMLS_C) * 10);
If no prefix is ββgiven and one searches for a php_combined_lcg definition that returns a float with one leading decimal number, the uniqid output should always contain 23 characters.
source share