/ Published in: PHP
(server_id)-(clientIP)-(unixtime)-(milliseconds)-(random)
I can easily determine which server at which time and who initiate creating of object.
Expand |
Embed | Plain Text
<?php $u=uuid(); // 0001-7f000001-478c8000-4801-47242987 echo $u; echo "<br>"; print_r(uuidDecode($u)); // Array ( [serverID] => 0001 [ip] => 127.0.0.1 [unixtime] => 1200390144 [micro] => 0.28126525878906 ) function uuid($serverID=1) { $serverID, clientIPToHex(), } function uuidDecode($uuid) { 'serverID'=>$u[0], 'ip'=>clientIPFromHex($u[1]), 'unixtime'=>hexdec($u[2]), ); } return $rez; } function clientIPToHex($ip="") { $hex=""; } return $hex; } function clientIPFromHex($hex) { $ip=""; } return $ip; } ?>
You need to login to post a comment.
