On Wed, Sep 12, 2012 at 2:37 PM, Sebastian Krebs <krebs....@gmail.com> wrote:
> 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 as
> 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.



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

Reply via email to