Skip to main content

GUID for globally unique identifier

How to create GUID in php

1-guid stands for globally unique identifier generally used to create random unique strings in php, create access token in php

2-Mostly use of GUID for generating access token, generate unique id, generating unique string in php. Using this article how to create guide in php you can create a random string for any use to keep unique

3-GUID consists of alphanumeric characters only and is grouped in five groups separated by hyphens as seen in this example:

3F2504E0-4F89-11D3-9A0C-0305E82C3301

Eg:-

<?php

/**

* Generate Globally Unique Identifier (GUID)

* E.g. 2EF40F5A-ADE8-5AE3-2491-85CA5CBD6EA7

*

* @param boolean $include_braces Set to true if the final guid needs

*                                to be wrapped in curly braces

* @return string

*/

function generateGuid($include_braces = false) {

if (function_exists('com_create_guid')) {

if ($include_braces === true) {

return com_create_guid();

} else {

return substr(com_create_guid(), 1, 36);

}

} else {

mt_srand((double) microtime() * 10000);

$charid = strtoupper(md5(uniqid(rand(), true)));

$guid = substr($charid,  0, 8) . '-' .

substr($charid,  8, 4) . '-' .

substr($charid, 12, 4) . '-' .

substr($charid, 16, 4) . '-' .

substr($charid, 20, 12);

if ($include_braces) {

$guid = '{' . $guid . '}';

}

return $guid;

}

}

------------------------------------------------------------------------
Output:
$GUID = getGUID();
echo $GUID;

Comments

Disuza Jen said…
Randomly generate unique value
Disuza Jen said…
GUID is best function in php

Popular posts from this blog

All CSV data insert into MYSQL database

All CSV data insert into MYSQL database Function name : LOAD DATA LOCAL INFILE eg : # Make database connection :: $mysql = "LOAD DATA LOCAL INFILE 'Nulk-186677.csv' INTO TABLE product_details FIELDS TERMINATED BY ',' LINES TERMINATED BY '\\n' IGNORE 1 ROWS (@PRODUCT_TITLE,@PRODUCT_DESCRIPTION,@STYLE,@AVAILABLE_SIZES,@BRAND_LOGO_IMAGE,@THUMBNAIL_IMAGE,@COLOR_SWATCH_IMAGE,@PRODUCT_IMAGE,@SPEC_SHEET,@PRICE_TEXT,@PRODUCT_STATUS,@KEYWORDS) SET p_title = @PRODUCT_TITLE, p_desc = @PRODUCT_DESCRIPTION, p_style = @STYLE, p_available_size=@p_available_size, p_brand_logo_image=@p_brand_logo_imagem, p_brand_thumbnail_image=@p_brand_thumbnail_image, p_color_swatch_image=@p_color_swatch_image, p_image=@PRODUCT_IMAGE, p_spec_sheet=@SPEC_SHEET, p_prices_text=@PRICE_TEXT, p_status=@PRODUCT_STATUS, p_keywords=@KEYWORDS"; mysql_query($mysql);

Profile Share Fixing the Thumbnail Image, Title and Description for Shared Links

Profile Share Fixing the Thumbnail Image, Title and Description for Shared Links user want to share any information then use following code  and read step by step Profile Share Fixing the Thumbnail Image, Title and Description for Shared Links if you want share profile on following social link : 1-Facebook 2-twitter.com 3-LinkedIn 4-google +, Code link : https://drive.google.com/open?id=1IzTZZh_0euDqFSHL_vPRiQePlNTw3h-q Demo link : http://freeteachnology.hol.es/socialshare/ To modify a page's thumbnail image, description, and additional metadata for these services, you can provide meta tags in the HTML code of the page.Implementing Open Graph Meta Tags You can implement meta tags in a number of ways. In content management systems might  be allow you to modify a page's meta tags , then use following code in meta section of your project code, <link href="bootstrap.min.css" rel="stylesheet"> <link href="bootstrap-tour.m...