Skip to content

Instantly share code, notes, and snippets.

@arunkumartdr
Created December 22, 2021 09:31
Show Gist options
  • Save arunkumartdr/7579b68e18e41733b6a918afd64ef253 to your computer and use it in GitHub Desktop.
Save arunkumartdr/7579b68e18e41733b6a918afd64ef253 to your computer and use it in GitHub Desktop.
unique id in js and php
How to use it from another .js :
import { uid } from './uid';
To get a new id :
const id = uid();
Resource : https://www.instagram.com/p/CWW5WmHIeuS/
<?php
echo uniqid();
?>
export const uid = () {
const head = Date.now().toString(36);
const tail = Math.random().toString(36);
return head + tail;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment