I'm working on a web service which requires a new GUID()
passed as a reference to a method within the service.
I am not familiar with C#
or the GUID() object
, but require something similar for PHP
(so create a new object which from my understanding returns an empty/blank GUID
).
Any ideas?
You can try the following:
function GUID()
{
if (function_exists('com_create_guid') === true)
{
return trim(com_create_guid(), '{}');
}
return sprintf('%04X%04X-%04X-%04X-%04X-%04X%04X%04X', mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(16384, 20479), mt_rand(32768, 49151), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535));
}