On Feb 11, 11:58 pm, Andre <andre_susan...@yahoo.com> wrote:
> Hi all,
> Can anyone help on writing the snippet using cakephp core utility
> library to combine array?

If you look at Set::combine (http://book.cakephp.org/view/662/
combine), you'll notice that both the path for the key and/or the path
for the value can be specially formatted instead of just specifying a
normal path for each. There are many examples on that link that show
the many different possibilities for generating the combined array.

Here is an example snippet ($array contains the array you specified):
        $service_name = $array[0]['Service']['name'];
        $new_array = Set::combine($array, "0.Member.{n}.id", array("{1}, {0}-
$service_name", "0.Member.{n}.first_name", "0.Member.{n}.last_name"));
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to