nhance/app/Helpers/uuid_helper.php
2024-09-13 09:00:09 +05:30

20 lines
579 B
PHP
Executable File

<?php
// File: app/Helpers/Uuid_helper.php
// if (!function_exists('generate_uuid')) {
// function generate_uuid($version = 4, $format = 'hex')
// {
// $data = random_bytes(16);
// // echo $data.'<br>';
// // Set version to 0100
// $data[6] = chr(ord($data[6]) & 0x0f | 0x40);
// // Set bits 6-7 to 10
// $data[8] = chr(ord($data[8]) & 0x3f | 0x80);
// // Output the 36 character UUID.
// $uuid = vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4));
// return $uuid;
// }
// }