Ask a Question related to PHP Development, Design and Development.
-
patuf #1
generationg an UUID
Hi,
Is it possible to generate an UUID (GUID) in PHP?
An unique id like: "BF127074-8A15-4A32-A7B3-BEF9A2DBB65C"
Thanks
patuf Guest
-
When to use UUID
I use MYSQL, but I think this is a general database design question: <b>Is it a good idea to use UUIDs to generate unique indexes and primary keys... -
Database UUID problems
I am modifying the GetSubscribers() function to pull people who have signed up for specific categories. It works great when I manually put in which... -
Cant delete a row using a UUID as the PK
I'm trying to delete a row - that uses the datatype unique identifyer...(SQL2000) I get an error, I've tried using cfquerypqram (both the varchar... -
Using CHAR to store UUID in SQL Server
Hi, In SQL Server, I use CHAR to store UUID as primary for all my tables. Is there any performance disadvantage when performing linking with... -
ADO 2.8 UUID (for use with ASP on Windows 2003)
What is the UUID associated with ADO 2.8? The most current one I've found for use with ASP is: <!--METADATA TYPE="typelib"... -
Chris Hope #2
Re: generationg an UUID
patuf wrote:
Not as far as I am aware, but it's possible to generate 32 characters using> Is it possible to generate an UUID (GUID) in PHP?
>
> An unique id like: "BF127074-8A15-4A32-A7B3-BEF9A2DBB65C"
the md5() function, then uppercase the letters and add the dashes in the
appropriate places to make it look like a Microsoft GUID. If it doesn't
actually need to be a Microsoft type GUID then you don't necessarily need
to do the uppercasing or add in dashes.
Go to [url]http://www.php.net/md5[/url] for more information. Check the user comments
as they contain info about how to generate randomness for the md5 hash.
--
Chris Hope
The Electric Toolbox - [url]http://www.electrictoolbox.com/[/url]
Chris Hope Guest
-
patuf #3
Re: generationg an UUID
using> Not as far as I am aware, but it's possible to generate 32 charactersIt doesn't need to be a GUID.> the md5() function, then uppercase the letters and add the dashes in the
> appropriate places to make it look like a Microsoft GUID. If it doesn't
> actually need to be a Microsoft type GUID then you don't necessarily need
> to do the uppercasing or add in dashes.
>
But it has to be UNIQUE... Using md5 doesn't garanty me that it will be
unique right?
Anyway, in my case it only has to be unique *on my system* so I'll use an
easy workaround with date + random number.
But I think it's something missing in PHP to be able to generate a true
UUID...
Thanks
> Go to [url]http://www.php.net/md5[/url] for more information. Check the user comments
> as they contain info about how to generate randomness for the md5 hash.
>
> --
> Chris Hope
> The Electric Toolbox - [url]http://www.electrictoolbox.com/[/url]
patuf Guest
-
Rob #4
Re: generationg an UUID
"patuf" <fff@sdsd.ca> schreef in bericht news:AH8qc.15546$j6.171@edtnps84...need>> using> > Not as far as I am aware, but it's possible to generate 32 characters> > the md5() function, then uppercase the letters and add the dashes in the
> > appropriate places to make it look like a Microsoft GUID. If it doesn't
> > actually need to be a Microsoft type GUID then you don't necessarilycomments>> > to do the uppercasing or add in dashes.
> >
> It doesn't need to be a GUID.
>
> But it has to be UNIQUE... Using md5 doesn't garanty me that it will be
> unique right?
>
> Anyway, in my case it only has to be unique *on my system* so I'll use an
> easy workaround with date + random number.
>
> But I think it's something missing in PHP to be able to generate a true
> UUID...
>
> Thanks
>
>
>> > Go to [url]http://www.php.net/md5[/url] for more information. Check the userDoes the function uniqid() suites your purpose?>> > as they contain info about how to generate randomness for the md5 hash.
> >
> > --
> > Chris Hope
> > The Electric Toolbox - [url]http://www.electrictoolbox.com/[/url]
>
[url]http://nl.php.net/manual/nl/function.uniqid.php[/url]
HTH Rob
Rob Guest
-
Chris Hope #5
Re: generationg an UUID
Rob wrote:
>> But I think it's something missing in PHP to be able to generate a true
>> UUID...> comments>> > Go to [url]http://www.php.net/md5[/url] for more information. Check the user>> > as they contain info about how to generate randomness for the md5 hash.Crap. And I'd seen that function before too... probably even used it in my> Does the function uniqid() suites your purpose?
>
> [url]http://nl.php.net/manual/nl/function.uniqid.php[/url]
code somewhere... *sigh*
Note though that it's still based on the current time in microseconds
(according to the manual anyhow) so it is possible (however unlikely) it
may have the same value on another host. In the case of the original poster
this should be OK as he was only wanting a unique value for his host.
--
Chris Hope
The Electric Toolbox - [url]http://www.electrictoolbox.com/[/url]
Chris Hope Guest
-
patuf #6
Re: generationg an UUID
> Does the function uniqid() suites your purpose?
>
> [url]http://nl.php.net/manual/nl/function.uniqid.php[/url]
>
Oh yeah, that's what I was looking for. I had no luck seraching for "php
uuid" on google...
Thanks!
patuf Guest



Reply With Quote

