Reason for asking:
I am utilizing memcached for cache storage in
Well, since Memcached doesn't store raw objects (it actually stores the serialiezd version), you can do this:
$serializedFoo = serialize($foo);
if (function_exists('mb_strlen')) {
$size = mb_strlen($serializedFoo, '8bit');
} else {
$size = strlen($serializedFoo);
}
Another easy way pute content of array to file and then check file size.
$str = print_r($array, true);
file_put_contents('data.txt', $str);
$size = filesize('data.txt');