Created
March 10, 2016 20:30
-
-
Save jasonbronson/ca31af6611e07967b050 to your computer and use it in GitHub Desktop.
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 namespace App\Models; | |
class GeneralModel{ | |
public function getGUID(){ | |
mt_srand((double)microtime()*15000);//optional for php 4.2.0 and up. | |
$charid = strtoupper(md5(uniqid(rand(), true))); | |
$uuid = substr($charid, 0, 8) | |
.substr($charid, 8, 4) | |
.substr($charid,12, 4) | |
.substr($charid,16, 4) | |
.substr($charid,20,12); | |
return $uuid; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment