Conditions | 1 |
Paths | 1 |
Total Lines | 20 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
33 | public static function generate() |
||
34 | { |
||
35 | |||
36 | mt_srand((double)microtime()*10000); |
||
37 | $charid = strtoupper(md5(uniqid(rand(), true))); |
||
38 | $hyphen = chr(45);// "-" |
||
39 | $uuid = chr(123)// "{" |
||
40 | .substr($charid, 0, 8).$hyphen |
||
41 | .substr($charid, 8, 4).$hyphen |
||
42 | .substr($charid,12, 4).$hyphen |
||
43 | .substr($charid,16, 4).$hyphen |
||
44 | .substr($charid,20,12) |
||
45 | .chr(125);// "}" |
||
46 | |||
47 | $uuid = str_replace('{', '' , $uuid); |
||
48 | $uuid = str_replace('}', '' , $uuid); |
||
49 | |||
50 | return $uuid; |
||
51 | |||
52 | } |
||
53 | } |