php uuid generator code example

Example 1: generate guid c#

Guid g = Guid.NewGuid();
string guid = Guid.NewGuid().ToString();

Example 2: unique identifier guid example

GUID
------------------------------------
3297F0F2-35D3-4231-919D-1CFCF4035975

(1 row affected)

Example 3: uuid generator js

function uuidv4() {
  return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
    var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
    return v.toString(16);
  });
}

console.log(uuidv4());

Example 4: uuidv4

import { v4 as uuid_v4 } from "uuid";
uuid_v4()

Example 5: generate a unique id

md5(uniqid(time()));

Example 6: uuid generator js

function uuidv4() {
  return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, c =>
    (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
  );
}

console.log(uuidv4());

Tags:

Php Example