PHP memory usage (references)

Warning: PHP4 has a 16 bit reference count which severely limits how many entries you can put in an array using this technique. Your program will corrupt memory if you exceed this limit. This is fixed in php5 which has a 32 bit reference count.

I just discovered a cute way to save memory in php. One of my favorite data structures is an inverted array where the interesting values are the keys, and the array values are meaningless. For example:

array(
0 => "bunny",
1 => "paboom",
2 => "mummy",
);

becomes

array(
"bunny" => true,
"paboom" => true,
"mummy" => true,
);

The idea is that I can check for array values in constant time now. The loss of the indices is not important because the data was not ordered to begin with, even though it was represented as an ordered array. Basically it's a hash table.

The only problem here is that I'm storing a copy of true for every single array entery. What can we do about that?