RSS
 

Archive for February 23rd, 2012

Generate UUID in PHP

23 Feb

I posted this last year to PHP.net and thought I’d just share it here as well. It’s a short write-up and demonstration of a PHP class you can use to generate various versions of a Universally-Unique Identifier, or UUID.

The php5-uuid functions could definitely use some documentation to clarify how they should be used, but here’s what I’ve gleaned by examining the OSSP source code (found here: http://ossp-uuid.sourcearchive.com/documentation/1.5.1-1ubuntu1/php_2uuid_8c-source.html).

The uuid_make() function takes two arguments when generating v1 or v4, but four arguments are required when generating v3 or v5. The first two arguments have been thoroughly demonstrated and are straightforward, so I’ll skip to the as-yet non-described arguments.

Read the rest of this entry »

 
3 Comments

Posted in PHP