[PHP] Finding the sizeof a variable....
Hi, I'm wondering if there's something similar to the C sizeof operator in PHP? I would like to find out how much space in memory a variable is actually using (and possibly adjust the max memory per script accordingly). No, sizeof() http://us3.php.net/sizeof is not what I want :-( Thanks! Matt -- Matt Blasinski (mbv) Software Engineer Internet Infrastructure Applications Technology Division of Information Technology 3121 Computer Science and Statistics 1210 West Dayton Street Madison WI 53706 Work (608) 262-2286 Personal Cell (608) 347-6940 ?php echo You can have it fast, cheap, or working. Choose two.; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Finding the sizeof a variable....
There is memory_get_usage() but it returns the amount of memory allocated to PHP. http://us3.php.net/manual/en/function.memory-get-usage.php I'm wondering if there's something similar to the C sizeof operator in PHP? I would like to find out how much space in memory a variable is actually using (and possibly adjust the max memory per script accordingly). No, sizeof() http://us3.php.net/sizeof is not what I want :-( Thanks! Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Finding the sizeof a variable....
Matthew A. Blasinski wrote: Hi, I'm wondering if there's something similar to the C sizeof operator in PHP? I would like to find out how much space in memory a variable is actually using (and possibly adjust the max memory per script accordingly). No, sizeof() http://us3.php.net/sizeof is not what I want :-( Thanks! Matt Not exactly what you want, but it's the closest you can get: memory_get_usage() I guess with a little experimanting you will be able to guess exact alocated memory. For example strings seem to take strlen() + 110 (or 120?) bytes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php