note 73112 added to function.mssql-guid-string

From: Date: Fri, 09 Feb 2007 11:05:10 +0000
Subject: note 73112 added to function.mssql-guid-string
Groups: php.notes 
Request: Send a blank email to php-notes+get-123168@lists.php.net to get a copy of this message
Here is the function that will present the GUID as we commonly know it in PHP. I designed this function before noticing the one (slightly documented in here). It has been fully tested and works. function presentGUID($string) { $hex = ''; $len = strlen($string); $bytes = array(); for ($i = 0; $i < $len; $i++) { $bytes [$i] = strtoupper(str_pad(dechex(ord($string[$i])), 2, 0, STR_PAD_LEFT)); } $this->swapbyte ($bytes[0], $bytes[3]); $this->swapbyte ($bytes[1], $bytes[2]); $this->swapbyte ($bytes[4], $bytes[5]); $this->swapbyte ($bytes[6], $bytes[7]); $hex = "{"; for ($i = 0; $i < $len; $i++) { switch ($i) { case 4: case 6: case 8: case 10: $hex .= "-"; } $hex .= $bytes[$i]; } $hex .= "}"; return $hex; } function swapbyte(&$value1, &$value2) { $tmp = $value1; $value1 = $value2; $value2 = $tmp; } ---- Server IP: 83.138.144.80 Probable Submitter: 213.128.226.33 (proxied: 1.1 OPUSPROXY001) ---- Manual Page -- http://www.php.net/manual/en/function.mssql-guid-string.php Edit -- https://master.php.net/note/edit/73112 Del: integrated -- https://master.php.net/note/delete/73112/integrated Del: useless -- https://master.php.net/note/delete/73112/useless Del: bad code -- https://master.php.net/note/delete/73112/bad+code Del: spam -- https://master.php.net/note/delete/73112/spam Del: non-english -- https://master.php.net/note/delete/73112/non-english Del: in docs -- https://master.php.net/note/delete/73112/in+docs Del: other reasons-- https://master.php.net/note/delete/73112 Reject -- https://master.php.net/note/reject/73112 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#123168) next »