Created
June 25, 2017 07:08
-
-
Save shahid249/7166828c66c8e5779015499cd67b1ce8 to your computer and use it in GitHub Desktop.
Random Unique ID Generator in PHP
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 | |
// with prefix | |
$uniqueid = uniqid('prefixhere_'); | |
echo $uniqueid; | |
/* prints | |
prefixhere_594f60936a7e9 | |
*/ | |
// with more entropy | |
$uniqueid_2 = uniqid('',true); | |
echo $uniqueid_2; | |
/* prints | |
594f60b9819a19.45879433 | |
*/ | |
// prefix + entropy | |
$uniqueid_3 = uniqid('prefixand_',true); | |
echo $uniqueid_3; | |
/* prints | |
prefixand_594f60d83cda14.54121719 | |
*/ | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment