This is a discussion on array size in bytes within the PHP General forums, part of the PHP Programming Forums category; Hi, Exists in PHP function returning array size in bytes ? (For saving array into shared memory without serialize.) Thnx. Roman...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
On Mon, October 2, 2006 3:07 am, Roman Rumisek wrote:
> Exists in PHP function returning array size in bytes ? > (For saving array into shared memory without serialize.) No. And you could maybe write one, if it was all strings in the array, but you're gonna be screwed when PHP 6 with Unicode comes out, cuz the number of bytes "depends" on where you're gonna store it, in which charset, and several other factors... There was a thread on PHP-internals last month about the the strlen() function should or shouldn't do for that -- and if sizeof() should or shouldn't do something different. You probably shouldn't be poking it into shared memory without serializing it anyway, I don't think... -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? |
|
|||
|
At 4:18 PM -0500 10/2/06, Richard Lynch wrote:
>On Mon, October 2, 2006 3:07 am, Roman Rumisek wrote: >> Exists in PHP function returning array size in bytes ? >> (For saving array into shared memory without serialize.) > >No. > >And you could maybe write one, if it was all strings in the array, but >you're gonna be screwed when PHP 6 with Unicode comes out, cuz the >number of bytes "depends" on where you're gonna store it, in which >charset, and several other factors... > >There was a thread on PHP-internals last month about the the strlen() >function should or shouldn't do for that -- and if sizeof() should or >shouldn't do something different. > >You probably shouldn't be poking it into shared memory without >serializing it anyway, I don't think... > How about saving the array as a file and then do a filesize()? tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com |