I want to create a wrapper class that will use duplicate keys, while hash settings do not allow defaults. The class should use the element overload mechanism introduced in php5, so it will simulate all standard hashes of behavior. For example, I want to have something like
$var => obj( :values_arr -> array(
obj(:key -> 'mykey', :value -> 'val1'),
obj(:key -> 'mykey', :value -> 'val2')
)
)
If I want to get $ var ['mykey'], it should return an array ('val1', 'val2'), but if I want to extend obj with a new pair of 'mykey' => 'value, I will call
$val['mykey'][] = 'value'
The main idea is that the hash behavior has been saved, and after trying to assign a value to the use of an existing key, it will not be overwritten, but added to the list.
php5 ( 5.3)? - , ?