-
-
Save anonymous/a1e690d1dae2c7493867 to your computer and use it in GitHub Desktop.
generate uuid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Generate a UUID | |
* Plugin URI: http://xhost.se | |
* Description: Generates a UUID to use for emediate takeover precision | |
* Author: Tomas Lindhoff | |
* Author URI: http://xhost.se | |
* Version: 0.1 | |
*/ | |
function uuid($prefix = '') | |
{ | |
$chars = md5(uniqid(mt_rand(), true)); | |
$uuid = substr($chars,0,8) . '-'; | |
$uuid .= substr($chars,8,4) . '-'; | |
$uuid .= substr($chars,12,4) . '-'; | |
$uuid .= substr($chars,16,4) . '-'; | |
$uuid .= substr($chars,20,12); | |
return $prefix . $uuid; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment