Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
PHP: com_create_guid - Manual
[go: Go Back, main page]

PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

com_event_sink" width="11" height="7"/> <com_addref
Last updated: Mon, 05 Feb 2007

view this page in

com_create_guid

(PHP 5)

com_create_guid — グローバルユニーク ID (GUID) を生成する

説明

string com_create_guid ( void )

Globally Unique Identifier (GUID) を生成し、文字列で返します。 GUID は DCE UUID と同様の方法で生成されますが、Microsoft の 規約により、GUID が中括弧で囲まれるという点が異なります。

PECL uuid 拡張モジュールの uuid_create() も参照ください。



add a note add a note User Contributed Notes
com_create_guid
Kristof_Polleunis at yahoo dot com
29-Apr-2005 12:16
A guid function that works in all php versions:

<?php
function guid(){
   if (
function_exists('com_create_guid')){
       return
com_create_guid();
   }else{
      
mt_srand((double)microtime()*10000);//optional for php 4.2.0 and up.
      
$charid = strtoupper(md5(uniqid(rand(), true)));
      
$hyphen = chr(45);// "-"
      
$uuid = chr(123)// "{"
              
.substr($charid, 0, 8).$hyphen
              
.substr($charid, 8, 4).$hyphen
              
.substr($charid,12, 4).$hyphen
              
.substr($charid,16, 4).$hyphen
              
.substr($charid,20,12)
               .
chr(125);// "}"
      
return $uuid;
   }
}
echo
guid();
?>

com_event_sink" width="11" height="7"/> <com_addref
Last updated: Mon, 05 Feb 2007
 
 
show source | credits | sitemap | contact | advertising | mirror sites