but you're trying to pass stuff to it:
public function tostring() {
$str = $this-binstr($this-bits[0]);
for ($i=1;$i8;$i++)
$str .= , . $this-binstr($this-bits[$i]);
return $str;
}
Slap (on my face)! My stupidity... I come from a strongly typed language
Just tried serializing array of 256 booleans and printing the length, it
really shocked me: 2458. This project will be used by about 500 students, so
in the worst case (all students enroll all courses) it will eat 500 * 2458
(assuming one character eats one byte) = 1229000 Bytes ~= 1.2 MB. Not a
On Tue, Feb 24, 2009 at 3:24 AM, leledumbo leledumbo_c...@yahoo.co.id wrote:
Just tried serializing array of 256 booleans and printing the length, it
really shocked me: 2458. This project will be used by about 500 students, so
in the worst case (all students enroll all courses) it will eat 500
Generally relationships like the one you describe are stored in three
separate and related tables: Students, Courses, and Enrollment. The
latter is a n:m association between the first two. The advantage this
approach has with regard to storage is that it is a sparse matrix.
I've done that
On Wed, Feb 25, 2009 at 12:12 AM, leledumbo leledumbo_c...@yahoo.co.id wrote:
Generally relationships like the one you describe are stored in three
separate and related tables: Students, Courses, and Enrollment. The
latter is a n:m association between the first two. The advantage this
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() {
leledumbo wrote:
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
Some languages allows to bit-pack structures to save spaces. Since PHP
doesn't have native set data type and operations, will array of booleans be
optimized as such? If not, how can I achieve the same result? I need to save
about 200 boolean values and I guess it's a good idea to use bitsets.
you should not worry about optimizing boolean values unless you would store
them in database.
I DO need to store them in a database, that's why I'm asking. I won't care
if I only use PHP, since it won't keep my data in memory for a long time.
anyways, use bitwise operators
I think I've stated
9 matches
Mail list logo