Op 14 sep. 2012 07:51 schreef "Adam Richardson" <simples...@gmail.com> het
> On Wed, Sep 12, 2012 at 2:37 PM, Sebastian Krebs <krebs....@gmail.com>
> > Hi,
> >
> > In PHP the array is in fact a hash map, but especially it is _used_ for
> > nearly everything map-, set-, ...-like thing. So in short: The is no
> > operator or built-in function, that merges two arrays _and_ treat them
> > set (instead of the hashmap, what they are). Your solution is the way
to go.
> Sure, I know about the underlying implementation. I was just hopeful
> because several of the array functions handle the maps differently
> depending on whether the keys are numeric or string or both.
> If I wanted to get cute, I could store the value in the key (e.g.,
> array('value 1' => 0, 'value 2' => 0, ...)), and that allows me to use
> the '+' operator. In spite of the nice performance benefits of this
> approach (leveraging the hashes benefits), the code that utilizes the
> arrays becomes quite clunky.
> Thanks,
> Adam

It doesn't need to be clunky.. just use array_flip and you've got the old
array again..


Reply via email to