Created
          December 22, 2021 09:31 
        
      - 
      
- 
        Save arunkumartdr/7579b68e18e41733b6a918afd64ef253 to your computer and use it in GitHub Desktop. 
    unique id in js and php
  
        
  
    
      This file contains hidden or 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
    
  
  
    
  | 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/ | 
  
    
      This file contains hidden or 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 | |
| echo uniqid(); | |
| ?> | 
  
    
      This file contains hidden or 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
    
  
  
    
  | 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