Re: optimizing space for array of booleans

From: Date: Wed, 25 Feb 2009 06:08:44 +0000
Subject: Re: optimizing space for array of booleans
References: 1 2 3 4 5 6 7  Groups: php.general 
Request: Send a blank email to php-general+get-288778@lists.php.net to get a copy of this message
Good points, I'll try it. > Without testing it (it's late here), your binstr() function doesn't > accept parameters, so it would always return the same result each time > it's called, regardless of what you pass into it. In case you want to check it tomorrow or later: private function binstr() { $temp_bits = $this->bits; $str = ""; for ($i=0;$i<32;$i++) { $str = strval($temp_bits & 1) . $str; $temp_bits >>= 1; } return $str; } it doesn't accept parameters, but instead use private field $bits assigned to $temp_bits (PHP manual states that it will be copied instead of referenced, and it's exactly what I need). -- View this message in context: http://www.nabble.com/optimizing-space-for-array-of-booleans-tp22159131p22196899.html Sent from the PHP - General mailing list archive at Nabble.com.

« previous php.general (#288778) next »