Posts Generate UUIDs in PHP
Post
Cancel

Generate UUIDs in PHP

1
2
3
4
5
6
7
8
9
10
11
12
13
//src - https://rogerstringer.com/2013/11/15/generate-uuids-php/

<?php
function generate_uuid() {
	return sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
		mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ),
		mt_rand( 0, 0xffff ),
		mt_rand( 0, 0x0fff ) | 0x4000,
		mt_rand( 0, 0x3fff ) | 0x8000,
		mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff )
	);
}
?>

origin - http://www.pipiscrew.com/?p=8477 generate-uuids-in-php

This post is licensed under CC BY 4.0 by the author.
Contents

Trending Tags