Re: Unique ID on 5.0.4 (Windows)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dragan Stanojevic - Nevidljivi wrote:

Hi Chris,

Chris wrote:

Pretty soon I'm going to be needing to generate a unique identifier in a script. I'm looking into how to go about doing it now.

It has to work on Apache 2 / PHP 5.0.4 (Module) / Windows 2000 Server.

Any suggestions on how I might be able to do it?

I'd appreciate any help you could give me.


What you need is called hash function (function for creating keys in hash tables). In PHP manual they are categorized under String functions...

The way they work is that for any given string they return a (index) number (it can be shown a string of hex numbers) which is unique or almost unique (depending on the algorithm).

The ones you may be interested are: md5, sha1, crc32

http://www.php.net/md5
http://www.php.net/sha1
http://www.php.net/crc32

Failing those, you may use mhash functions:
http://www.php.net/manual/en/ref.mhash.php

Hope this will help you a little,
N::

I think you may have misunderstood me, sorry. I need to generate a unique string, to use as an identifier, in a script, not something to identify the script itself. A hash won't work for that.

Thanks anyway though.
Chris

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux