Monday, November 14, 2011

Re-order an Array

Hello everybody,

is there a method in CakePHP which allows me to convert the following
array to the expected result? I extract my start to a group by
creteria.

Array
(
[0] => Array
(
[Route] => Array
(
[id] => 3
[start] => Düsseldorf Hbf
[via] => Hannover Hbf
[end] => Kreiensen
)

)

[1] => Array
(
[Route] => Array
(
[id] => 2
[start] => Kreiensen
[via] => Hannover Hbf
[end] => Düsseldorf Hbf
)

)

[2] => Array
(
[Route] => Array
(
[id] => 4
[start] => Kreiensen
[via] =>
[end] => Würzburg Hbf
)

)

[3] => Array
(
[Route] => Array
(
[id] => 5
[start] => Würzburg Hbf
[via] =>
[end] => Kreiensen
)

)

)

To the following array:
?Array
(
[Düsseldorf Hbf] => Array
(
[id] => 3
[start] => Düsseldorf Hbf
[via] => Hannover Hbf
[end] => Kreiensen
)

),

[Kreiensen] => Array
(
[id] => 2
[start] => Kreiensen
[via] => Hannover Hbf
[end] => Düsseldorf Hbf
),
(
[id] => 4
[start] => Kreiensen
[via] =>
[end] => Würzburg Hbf
)

)

[Würzburg Hbf] => Array
(
[id] => 5
[start] => Würzburg Hbf
[via] =>
[end] => Kreiensen
)

)

)

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate