Re: uniqid() and repetition of numbers generated

From: Date: Sun, 15 Nov 2009 04:07:16 +0000
Subject: Re: uniqid() and repetition of numbers generated
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-299837@lists.php.net to get a copy of this message
2009/11/14 tedd <tedd.sperling@gmail.com> > A > Interesting thought. My idea on this is to use the approach used when replicating a DB. It is similar to the namespace idea if not the same: Say you have 3 databases, you could use mod 3 numbers for A=0, B=1 and C=2 So on A you would have 0, 3, 6, 9, ... on B 1, 4, 7, 10, ... and on C 2, 5, 8, 11. This way you can just use auto increment and set the increment value 3 and the start value to 0,1,2 respectively. Also, this way you will not run out of numbers until you run out of integers. ++Tim Hinnerk Heuer++ http://www.ihostnz.com

« previous php.general (#299837) next »