What are some methods for creating a unique string from an integer in PHP, taking into consideration the need for uniqueness and short length?

When creating a unique string from an integer in PHP, one approach is to use hashing functions like md5 or sha1 to convert the integer into a fixed-length string. To ensure uniqueness, you can combine the integer with a unique identifier like a timestamp or a random string before hashing. This will help in generating a unique string while keeping the length relatively short.

$integer = 12345;
$uniqueIdentifier = uniqid();
$combinedString = $integer . $uniqueIdentifier;
$uniqueString = sha1($combinedString);
echo $uniqueString;