Search
 
SCRIPT & CODE EXAMPLE
 

PHP

create guid in php

function guidv4()
{
    if (function_exists('com_create_guid') === true)
        return trim(com_create_guid(), '{}');

    $data = openssl_random_pseudo_bytes(16);
    $data[6] = chr(ord($data[6]) & 0x0f | 0x40); // set version to 0100
    $data[8] = chr(ord($data[8]) & 0x3f | 0x80); // set bits 6-7 to 10
    return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4));
}
Comment

PHP Function to create GUID

function create_guid() { // Create GUID (Globally Unique Identifier)
        $guid = '';
        $namespace = rand(11111, 99999);
        $uid = uniqid('', true);
        $data = $namespace;
        $data .= $_SERVER['REQUEST_TIME'];
        $data .= $_SERVER['HTTP_USER_AGENT'];
        $data .= $_SERVER['REMOTE_ADDR'];
        $data .= $_SERVER['REMOTE_PORT'];
        $hash = strtoupper(hash('ripemd128', $uid . $guid . md5($data)));
        $guid = substr($hash,  0,  8) . '-' .
                substr($hash,  8,  4) . '-' .
                substr($hash, 12,  4) . '-' .
                substr($hash, 16,  4) . '-' .
                substr($hash, 20, 12);
        return $guid;
    }
Comment

PREVIOUS NEXT
Code Example
Php :: why do we use php exceptions 
Php :: php import script 
Php :: remove all sessions in laravel 
Php :: remove item from collection 
Php :: php artisan ui tailwind css 
Php :: acf get field 
Php :: curl in laravel 
Php :: php sort by associative array value 
Php :: localhost didn’t send any data 
Php :: import facade URL laravel 
Php :: angular post phph 
Php :: duplicate record laravel 
Php :: erreur php 
Php :: laravel 6 get user id 
Php :: convert date to timestamp in laravel builder 
Php :: sum of the array elements in php 
Php :: php array has key 
Php :: ACF Photo Gallery Output 
Php :: default timezone php 
Php :: How to JSON encode a PHP array 
Php :: array find php 
Php :: migration laravel 
Php :: how to use stored procedure in laravel 
Php :: cakephp json response 
Php :: laravel nested query builder 
Php :: factory laravel 
Php :: query string in laravel 
Php :: get post index wordpress 
Php :: get domain url with https in laravel 
Php :: laravel form request custom error message 
ADD CONTENT
Topic
Content
Source link
Name
1+1 =