Re: optimizing space for array of booleans

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux