I am not sure whether this will bring the desired result but have a
look at the union operator
http://lu.php.net/manual/en/language.operators.array.php

Good luck

Claudia

On Feb 7, 4:07 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> This is not strictly a CakePHP question but I hope that is OK.
>
> I am trying to merge two arrays. One containing dummy-data for each
> hour of the day, the other containing actual data extracted from a
> model for only some hours.
>
> All keys are strings but keys that looks like nice integers to php
> gets treated as such. That sucks. I specifically set them as string
> for a reason. for a number of good and bad reasons I really don't want
> to rethink everything around this by using all numbers. I also would
> like to avoid using another for-loop when there are merge-functions.
>
> Is there a way to get array_merge() or Set::merge() to comply?
> Is there a way to merge these two arrays in the way I would expect
> them to be merged?
>
> code:
> Part of the dummy array
> (
>     [08] => 0
>     [09] => 0
>     [10] => 0
>     [11] => 0
>     [12] => 0
> )
> Part of the data to merge int it
> (
>     [10] => 5
>     [12] => 3
>     [09] => 4
> )
> Value '09' is padded and thus still a string. 10 and 12 is treated as
> numbers (dispite being generated as strings) and totally mess up the
> resulting array. The mess is different depending on the merge function
> I use.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to