Re: Deprecating uniqid()
| From: | Dan Ackroyd | Date: | Wed, 06 May 2020 12:40:33 +0000 |
| Subject: | Re: Deprecating uniqid() | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-110042@lists.php.net to get a copy of this message | ||
On Wed, 6 May 2020 at 13:34, Rowan Tommins <rowan.collins@gmail.com> wrote:
>
> On 5 May 2020 09:42:19 BST, Arvids Godjuks <arvids.godjuks@gmail.com> wrote:
> >So in my opinion, a better replacement for uniqid is needed -
>
> You're right that the requirements for "random" and "unique" are
> distinct. Perhaps what we need is a unique_string function that allows you to specify the format
> (length and some control over allowed characters) and uses
This is a problem that would be better solved in userland rather than
trying to design and evolve inside core PHP. And already has a very
good solution:
https://hashids.org/php/
That library is, in my opinion, a much better solution for the vast
majority of people who are (mis)using uniqid.
cheers
Dan
Ack