Unique ID for user directory ? |
[eluser]mci[/eluser]
Hi I need a unique ID for user directories. Will Code: md5(uniqid());
[eluser]WanWizard[/eluser]
Try to avoid uniqueid(), it's not very portable. It also generates id's which are hex values of the current time, not necessarily that unique. Instead, I would go for UUID's. There's a PECL extension for it, and there are also native PHP versions floating around.
[eluser]mci[/eluser]
Thank you. Do you have a recommendation which extension or class I should use?
[eluser]WanWizard[/eluser]
PECL is handy, but requires control over the PHP installation (which you might not have in all cases) so you can install it. Alternatively, you can use this PHP function: Code: function gen_uuid() { |
Welcome Guest, Not a member yet? Register Sign In |