Personally, I like to roll my own at least the first time around. Mainly, I do this for the educational value of trial and error and then comparing what I came up with to the
standard ways of doing it. Here how I do it:
- I take the elements returned by localtime
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime;
- randomize the order
- concatenate them
- I then prefix a standard string ( I use a different prefix for each website)
- I then md5_hex the whole thing
Before storing the session id in MySQL, I confirm that it is unique. To date this has never returned a duplicate id.