Last active
May 27, 2016 05:05
-
-
Save HavenShen/d5349ecf98254688a09c96dd41110a5e to your computer and use it in GitHub Desktop.
Generating real unique identifiers with 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 | |
$storedIds = [ | |
'abc', | |
'def', | |
// ... more stored Ids | |
]; | |
do { | |
$id = uniqid('image',true); | |
} while (in_array($id, $storedIds)); | |
var_dump($id); // use id |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment