Skip to content

Instantly share code, notes, and snippets.

View rahenrique's full-sized avatar
🐺

Rafael Henrique rahenrique

🐺
View GitHub Profile
@rahenrique
rahenrique / guid.php
Last active December 4, 2020 17:09
GUID em PHP útil para criação de identificadores únicos
<?php
function getGUID(){
mt_srand((double)microtime()*10000);
$charid = strtolower(md5(uniqid(rand(), true)));
$hyphen = chr(45);
$uuid = substr($charid, 0, 8).$hyphen
.substr($charid, 8, 4).$hyphen
.substr($charid,12, 4).$hyphen
.substr($charid,16, 4).$hyphen