note 85800 added to function.shm-attach

From: Date: Thu, 18 Sep 2008 12:31:56 +0000
Subject: note 85800 added to function.shm-attach
Groups: php.notes 
Request: Send a blank email to php-notes+get-144507@lists.php.net to get a copy of this message
Responding to jpeter1978 at yahoo dot com ... Assuming a character is typically two bytes, the size of a serialized variable (incl array or obj) is 2 * its strlen(). The 44 is 4 more than the 24 + 16 = 40 suggested by php at cytrax dot de plus 4 bytes for worst case 4-byte alignment. So this is probably a reliable formula if you are too lazy to align it using something similar to zeppelinux at comcast dot net as in: ($strlen($serialized_array_or_obj) /4 ) * 4 ) + 40; The zeppelinux formula would use 20 (for 4-byte integer cpu) or 36 (for 64-bit or 8-byte cpu) for the ending constant so 40 or 44 is probably just achieving header padding but it certainly can't hurt. ---- Server IP: 64.71.164.2 Probable Submitter: 68.7.39.155 ---- Manual Page -- http://www.php.net/manual/en/function.shm-attach.php Edit -- https://master.php.net/note/edit/85800 Del: integrated -- https://master.php.net/note/delete/85800/integrated Del: useless -- https://master.php.net/note/delete/85800/useless Del: bad code -- https://master.php.net/note/delete/85800/bad+code Del: spam -- https://master.php.net/note/delete/85800/spam Del: non-english -- https://master.php.net/note/delete/85800/non-english Del: in docs -- https://master.php.net/note/delete/85800/in+docs Del: other reasons-- https://master.php.net/note/delete/85800 Reject -- https://master.php.net/note/reject/85800 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#144507) next »