How to get Object size
Posted: Fri Apr 25, 2008 11:37 am
Hello,
I have a question. I have an object that I obtain from making a SOAP request. This object contains lots of multidimensional arrays. What I need to know is the memory size of this object. I tried to write it into a file, but all I got was Array Array, but these arrays contain huge amounts of text. So I tried the following:
But I got strange output "11". I need to get the memory size of this object. So I try to place its contents into a file. Is there a way to:
1) Either write object's contents into a file similar to what I try to do.
2) Is there a generic PHP function that returns the size of an object given an object as parameter?
Thank you so much,
Victor.
I have a question. I have an object that I obtain from making a SOAP request. This object contains lots of multidimensional arrays. What I need to know is the memory size of this object. I tried to write it into a file, but all I got was Array Array, but these arrays contain huge amounts of text. So I tried the following:
Code: Select all
$fp = fopen('file.txt', 'w');
fwrite($fp, print_r($my_object));
1) Either write object's contents into a file similar to what I try to do.
2) Is there a generic PHP function that returns the size of an object given an object as parameter?
Thank you so much,
Victor.