I have the following array:
Array
(
[0] => Array
(
[User] => Array
(
[firstname] => Chris
[lastname] => Willis
)
)
[1] => Array
(
[User] => Array
(
[firstname] => Test
[lastname] => Willis
)
)
...
I need it to be transformed into a structure similar to this:
Array
{
'Chris-Willis' => 0
'Test-Willis' => 1
....
What are some array functions to help to do this?
So it needs to be:
firstname-lastname => id
CakePHP has the Set::combine() method to help with such situations.
I’m assuming that you want the array values to be the database ID of the user, rather than the array index.