note 17846 added to function.session-id

From: Date: Fri, 28 Dec 2001 17:55:18 +0000
Subject: note 17846 added to function.session-id
Groups: php.notes 
Request: Send a blank email to php-notes+get-23914@lists.php.net to get a copy of this message
The last piece that you mentioned for (i = 0; i < 16; i++) sprintf(buf + (i << 1), "%02x", digest[i]); buf[i << 1] = '\0'; causes it to step through the digest array and enter the value of each element into the buffer (buf) as follows (%02x): 0 indicates that the value should be left padded with zeros, 2 indicates that the value should be displayed with 2 places (columns), x indicates that the value should be formated in Hex rather than decimal. This is for storage purposed with C. C stores each character in its own memory location. So as the for loop runs it stores the values in a Hex format 2 "characters" long with a leading zero. The final piece \0 is a null value which must terminate all C "strings". -- http://www.php.net/manual/en/function.session-id.php http://master.php.net/manage/user-notes.php?action=edit+17846 http://master.php.net/manage/user-notes.php?action=delete+17846 http://master.php.net/manage/user-notes.php?action=reject+17846

« previous php.notes (#23914) next »