On Tue, 5 May 2020 at 08:52, Peter Bowyer <phpmailingli...@gmail.com> wrote:
> > On Tue, 5 May 2020 at 07:38, Niklas Keller <m...@kelunik.com> wrote: > >> Rowan Tommins <rowan.coll...@gmail.com> schrieb am Mo., 4. Mai 2020, >> 10:59: >> > Although the name sounds similar, I don't think UUID would be a good >> > replacement for uniqid(). In my experience, it's used for things like >> > generating ID attributes for HTML elements, or suffixes for table >> names, or >> > even file names; applications that really just need a few alphanumeric >> > characters that are different each time. >> >> Seems like UUIDs would be a good fit for all of these. >> > > For file names, absolutely. In many cases they have to be unique across > all processes, and that's important. For the others I say a UUID is only a > good replacement if taking a substring of a UUID is going to be unique. > As well as being nearly 3 times as long as the current uniqid() output, a UUID is generally formatted with hyphens, which may be disallowed or require careful quoting in various contexts. If you have to strip those out, or otherwise manipulate the result to fit the use case, you've failed at the original aim of having a single function that doesn't need further processing. (Leaving aside the fact that we don't actually have any UUID functions in core.) Regards, -- Rowan Tommins [IMSoP]