Reputation: 25
I've got a multidimensional array, which refers to itself multiple times. like:
$foo = array(
0 => array(
& $foo[1],
& $foo[2],
'bar',
),
1 => array(
& $foo[0],
& $foo[2],
'bar',
),
2 => array(
& $foo[0],
& $foo[1],
'bar',
),
)
Is there a way to get the size (in bites or in amout of elements) of this array?
Kind Regards,
Tempestas Ludi.
Upvotes: 1
Views: 146
Reputation: 16828
You can serialize the array, then determine the bytes using: mb_strlen()
$serialized = serialize($foo);
echo mb_strlen($serialized,'8bit');
Upvotes: 1