Re: Finding the sizeof a variable....

From: Date: Wed, 02 Jun 2004 20:30:02 +0000
Subject: Re: Finding the sizeof a variable....
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-187476@lists.php.net to get a copy of this message
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

« previous php.general (#187476) next »