/ Published in: PHP
Clase para generar ID-s únicos de forma automática mediante SHA1 de 40 caracteres
Expand |
Embed | Plain Text
/** * PHP Class for generating a Unique ID * 2005-01-10 Replaced with GLOBALS and PID ([email protected]) * 2005-01-02 Added more ingredients to hash ([email protected]) * 2004-12-10 First version ([email protected]) */ class UIDClass { // Private variable to hold current ID private $uid = ''; // Return current ID function getUID(){ // Generate ID if we have not done so already if($this->uid=='') $this->generateUID(); // Return ID return $this->uid; } // Generate new ID and store in private variable function generateUID(){ // Find seconds and microseconds from system clock // Seed the random number generator with above timings // Generate hash using GLOBALS and PID } }
You need to login to post a comment.
