I have to convert the first array into the second,
in the form of array(id=> data).
I am doing
Set::combine($array, '{n}.{n}.id', '{n}.{n}');
But its not working.Please tell me what is wrong in this or how it should be done.
Array1:
Array
(
[0] => Array
(
[0] => Array
(
[id] => 1
[user_id] => 1
[group_id] => 7
[comment] => Comment 1.
)
[1] => Array
(
[id] => 3
[user_id] => 4
[group_id] => 8
[comment] => Comment 4
)
)
Array2:
Array(
[1] => Array
(
[id] => 1
[user_id] => 1
[group_id] => 7
[comment] => Comment 1.
)
[3] => Array
(
[id] => 3
[user_id] => 4
[group_id] => 8
[comment] => Comment 4
)
)
Because
Set::combine()usesSet::extract()heavily, I don’t believe it’s possible to use more than a single numeric dimension at this time without some workarounds.Set::combine( $array[0], '{n}.id', '{n}' );will work.Use the following if you have multiple dimensions to cycle through: