Skip to content
Advertisement

How can I make short random unique keys, like YouTube video IDs, in PHP? [closed]

Is there any way to create unique keys like those used in YouTube video urls (ex: https://www.youtube.com/watch?v=nWChTnkVdKE)?

Advertisement

Answer

The idea is to convert a unique integer (such as current time) in an other mathematical base.

A very simple way in PHP :

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement